Posts by Davi Wesley • 544 points
27 posts
-
1
votes1
answer3140
viewsA: Most likely due to a circular import (How to Resolve)
Pessoa is calling for Empresa which is being declared just below, so how the code runs sequentially when it comes to Pessoa to Empresa it still won’t exist, to solve this is very simple just put in…
-
2
votes1
answer98
viewsA: TO BE executed asynchronously
Yes, there is a way to execute the for asynchronous see this article official documentation, but will not work in a queryset of Django for being synchronous, here are some suggestions for your…
-
1
votes3
answers81
viewsA: How to change a specific object into an object array?
I researched my case and I managed to find an ideal way to solve, I left comments in the code to help explain. const state = { books: [{name: "Maria", age:"22"},{name:"Roberto", age:20}] } const…
javascriptanswered Davi Wesley 544 -
0
votes3
answers81
viewsQ: How to change a specific object into an object array?
I have an object array that’s coming from my API that I’m saving on state const state = { books: [{name: "Maria", age:"22"},{name:"Roberto", age:20}] } how to change Roberto’s age in this case? what…
javascriptasked Davi Wesley 544 -
0
votes3
answers134
viewsA: Starting in Python
@Dionathan welcome to the community! with the type of variable you are using has no way, you need some other type of variable, I would use a list or a tuple, take a look at types of structure of…
pythonanswered Davi Wesley 544 -
0
votes1
answer94
viewsA: Django authentication
First be welcome to the web world with Django! would like to point out some things you can do to achieve what you want, first you need rewrite the method save of your model User because it is saving…
-
2
votes1
answer404
viewsA: Foreignkey of two tables in Django
There is the possibility of a table containing more than one foreign key but not a single foreign key referencing more than one table, what you can do is create one more property (a foreign key)so…
-
2
votes1
answer227
viewsA: What are Django’s view, serializer and model settings?
View View in Django is the business logic layer. It is responsible for processing the user request and sending a valid response. It fetches the data from model, provides every model access to…
-
0
votes1
answer2742
viewsA: How to install the language pack (English) in the VS code?
Go to the Extensions tab (Ctrl+Shift+X) look for this extension Portuguese (Brazil) Language Pack for Visual Studio Code after installation a dialog box will appear asking the confirmation for the…
visual-studio-codeanswered Davi Wesley 544 -
0
votes2
answers274
viewsA: Limit Simultaneous Access in Django
Django does not offer a native function to do this but you can implement this functionality using middleware, there are some ways you could do it in this question of the OS in English, I recommend…
-
2
votes1
answer70
viewsQ: Serialize/Deserializar struct for sending via sockets
I have a struct that I would like to serialize/disallow to send in a connection via sockets using the function send and recover that struct with the function recv, what are the ways I can solve this…
-
0
votes2
answers73
viewsA: How do I get Django to see the folders on my computer?
Generally is not advised to use Django to serve files in production, use a dedicated server such as Nginx. Most major sites Django uses a separate web server - that is, one that is not also serving…
-
0
votes2
answers1083
viewsA: Passes template content to view Django
The recommended way to do this is by using the forms from Django, it would look something like this. # forms.py from django import forms class NameForm(forms.Form): celular =…
djangoanswered Davi Wesley 544 -
1
votes1
answer106
viewsA: Place the fields of a Django form on the same line
I only removed the div who were inside the inputs <div id="interval" class="form-inline"> <div class="two wide field"> {% for price in prices %} <label>Preço</label> {{…
-
1
votes1
answer5363
viewsA: Install JDK 8, 9 or 10 on Ubuntu 18.04
Install Oracle’s Java 8 $ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer Check the installed version Leave version 8 as default $…
-
4
votes4
answers1053
viewsA: Python Queue Code - How to check if there is an element with a specific name in the queue and its index position?
When creating classes it is good practice to start with uppercase class Pessoa, any method of a class that is part of the instance (non-static methods) must have as its first parameter self, some of…
-
3
votes1
answer52
viewsA: How to remove the OS user name
Use the strip along with getuser import os import sys import platform from getpass import getuser diretorio = os.path.dirname(os.path.abspath(__file__)).strip(getuser()) print(diretorio)…
-
1
votes1
answer153
viewsQ: Non-blocking execution with asynchronous Python functions
I want a certain flow to continue even calling a async.sleep() in the code, I have the following code import asyncio async def funcao_1(name): print("entrando no sono...") await asyncio.sleep(3)…
-
1
votes1
answer830
viewsA: How to export a Node class?
Using ES6 export default Retangulo and then do import Retangulo from "./teste.js" see more examples Using previous versions class Retangulo { constructor(altura, largura){ this.altura = altura…
node.jsanswered Davi Wesley 544 -
1
votes2
answers79
viewsA: Creating routers for multiple databases in Django
A native alternative would be to use the database routing, see the example that documentation provides, when using database routing Django offers an API for specify on which basis you want to save…
-
0
votes3
answers208
viewsA: How to configure Settings.py to use Django-tenant-schema?
To configure django-tenant-schemas the instructions are in the repository from the github and on readthedoc, follow all the instructions provided to make sure you haven’t forgotten anything…
-
2
votes1
answer302
viewsA: How to remove all items from a Many-to-Many relation in Django?
To remove all tags related to Django offers the function clear that removes all objects from the set of related objects without deleting the relations only by removing the association, if you want…
-
-1
votes2
answers1146
viewsA: How do I pass the value to: "this.props" - React Native
the function connect takes two arguments that are the mapStatetoProps which must be a function and mapDispatchToProps which may be a function or an object see documentation, in your code you are…
-
5
votes2
answers172
viewsQ: Why don’t I need to declare the parameter in the function?
In the React documentation he brings an example of form, when the input receives some property value onChange is called with the function handleSubmit(event) in that way onChange={this.handleChange}…
-
0
votes2
answers2480
viewsA: React JS + PHP help
The function map only works in Arrays, to make sure the return of the api is within a Array use the following code //METODO 3 fetch("http://localhost/apihunt/carro/read.php") .then((response) =>…
-
-1
votes1
answer169
viewsA: Different behaviors between Linux and Windows using threads(pthreads)
It turns out that it is a bug in the compiler, to solve this problem to work on both platforms use a pointer in struct, for more details on the solution see this other thread in stackoverflow…
-
1
votes1
answer169
viewsQ: Different behaviors between Linux and Windows using threads(pthreads)
I’m using the Linux pthreads library to try out the functionality of threads, the code below prints 5 messages on the screen for each thread, each thread waits its turn to display the message…