Posts by Carlos Cortez • 307 points
23 posts
-
0
votes2
answers45
viewsA: Tkinter and class
As Elton Nunes commented, to "disable" the place of your code it already shows changes. as in the following images: But if your intention is just that, despite being a bad solution, it works.…
-
1
votes1
answer43
viewsA: Django - add user as team member in view
Hello, this desired behavior is related to the existing model: .virtualenvs/nome_do_projeto/lib/python3.7/site-Packages/Django/contrib/auth/models.py One of the templates within this python file is…
-
-1
votes2
answers29
viewsA: Error importing Model Django 3.1
instead of: From .models import * uses lower case letter: from .models import ModelAlpha, ModelBeta, NomeQualquerModel there is also the possibility that your file is under a different name, so it…
-
0
votes1
answer72
viewsA: Restart Django Python server
"TypeError: init() missing 1 required positional argument: 'on_delete'" This means that on line 18 of your file py.models is missing an argument *on_delete* which refers to a foreign key you…
-
0
votes1
answer126
viewsA: How do I filter queries from my database by Python? Using mysql
Here’s a possibility to use Python to search the database. Note that your code makes use of command "SELECT * FROM cpd_room" that asks to return all data recorded in cdp_room. It is necessary to…
-
0
votes2
answers107
viewsA: How to filter choices from a field based on choices from another form field in Django?
Leonardo, I will answer by following your question "How to filter choices from a field based on choices from another form field in Django?" using Javascript pq did not understand your description of…
-
3
votes1
answer32
viewsA: Problem extending the Django.db.models.Manege class
I do not understand very well what you want to do, but if you want to list everything, just do not filter in Manager class ProductManager(models.Manager): def get_queryset(self): return…
djangoanswered Carlos Cortez 307 -
0
votes1
answer34
viewsA: How to format money fields in Django?
Leonardo, in the model itself you could do it dinheiro = models.DecimalField(max_digits=10, decimal_places=2) if the user places 3 houses or more, an error message appears indicating the maximum…
-
2
votes3
answers37
viewsA: Send template data to database
if request.method == 'POST': form = AdicionaProfessor(request.POST) You say your method apparently doesn’t even go through form.is_valid() most probably because the method that the view receive is…
-
1
votes1
answer123
viewsA: Validate csv file in Django
in the imports of its py.models from django.core.validators import FileExtensionValidator from django.db import models from chamadas import forms removes the last line: from django.core.validators…
-
-1
votes2
answers50
viewsA: How to send text via the template via url in Django?
I tried to simulate the same error that were made available here but could not. I did as described: on a page index without much HTML code put the hyperlinks: {% load bootstrap4 %} {% load static %}…
-
1
votes1
answer53
viewsA: Script created in Pycharm closes by pressing the "enter" key inside the terminal
without seeing your code it gets a little difficult to help you, but I believe that what is happening is something normal: the program executes the code to receive an information performs all the…
-
1
votes1
answer26
viewsA: Error running makemigrations on my Django project
class Music(models.Model): id_music = models.UUIDField( primary_key=True, default=uuid.uuid4, editable=True, unique=True ) No need to call the function with ( )…
-
0
votes2
answers131
viewsA: Insert data with pymysql into a mysql database error. How to resolve?
I confess I was left with some doubts: Why import pymysql with Mysqldb name and you could install Mysqldb directly? Why import pymysql twice? Why enter the data as in the question:…
-
1
votes3
answers73
viewsA: Doubt about storing the function result in a list and the types of stored variables
a = float(input("Insira o valor inicial") b = float(input("Insira o valor final") c = [] def variacao_percentual(a,b): print(((a/b)-1)*100) c.append(((a/b)-1)*100) print(c) variacao_percentual(a,b)…
-
3
votes4
answers82
viewsA: How do I create a list for possible answers in python?
nom = str(input('Você gosta de mim? ')) lista = ['sim','claro','obvio'] if nom in lista: print('obrigado, bom saber') else: print('Que pena') …
-
0
votes2
answers158
viewsA: Django Staticfiles not found css does not load
Rodrigo, write the complete path to the folder containing the static file: STATICFILES_DIRS = [ "/home/projeto/app/static", ] and also checks whether INSTALLED_APPS is mentioned…
-
0
votes2
answers43
viewsA: Django - DATABASES configuration
Adriano, when you are setting up in Settings the database as illustrated by vc in the question, you are creating a dictionary that will represent key and value. If the DATABASE attribute is required…
-
0
votes1
answer43
viewsA: delete a key from Django’s bank
Luciano, as the Category model is within the Product via Inline model, what Jango assumes is that they contain a relationship. Therefore, deleting line 57 would result in the error reported in the…
djangoanswered Carlos Cortez 307 -
0
votes1
answer54
viewsA: Django - How to present last value registered in the database in a registration screen
It was a very simple problem to solve but it had nothing to do with what I was reading to try to solve. Basically: I created a tag and used the html copy of the template change_form.html who had…
-
1
votes1
answer44
viewsA: How many Apps can I have in a Django project?
"can have more than one app in a Django project?" Can yes "If so, what’s the point, when will I need to have more than one app?" Organizing. Take the test of creating two more app in your project,…
djangoanswered Carlos Cortez 307 -
0
votes2
answers157
viewsA: Django: Css not imported
Checks to change STATIC_PATH = os.path.Join(BASE_DIR, 'Static') for STATIC_ROOT = os.path.Join(BASE_DIR, 'staticfiles') and excludes the STATICFILES_DIRS = (STATIC_PATH,) Also checks if the…
-
0
votes1
answer54
viewsQ: Django - How to present last value registered in the database in a registration screen
I’m young, and I’m still facing difficulties that might seem pretty simple to you. I decided for personal reasons to make an application in Django. It is a simple registration of people in a Mysql…