Most voted "django" questions
Django is an open source Web 2.0 application framework written in Python. Its main objective is to facilitate the creation of complex database websites.
Learn more…1,067 questions
Sort by count of
-
1
votes1
answer420
viewsqueries in Django’s views and template
I have two tables (Client) and (Animal), the animal table is related through a Foreign key with the Client table, currently I can register only client, register client and animal together, in the…
-
1
votes2
answers666
viewsGet the user logged in to Django Admin
Good morning, you guys. I have a small application made entirely in Django Admin and I need to get the user logged in to make a specific query listing registered customers and and other models by…
-
1
votes1
answer485
viewsDjango 2.2 error - mysql connection
Hello! Here’s the thing, I’m having a problem connecting to mysql with Django. The error is this: Django.core.exceptions.Improperlyconfigured: Error loading Mysqldb module. Did you install…
-
1
votes0
answers205
viewsDirect assignment to the forward side of a Many-to-Many set is prohibited. Use morador.set() Instead
I’m building an API for a condo system, and when I try to select the residents, I get the following exception: TypeError at /apartamento/ Direct assignment to the forward side of a many-to-many set…
-
1
votes0
answers278
viewsDJANGO error: Django.core.exceptions.Improperlyconfigured in the initial tutorial!
I’m a beginner in Python and I’m doing the Django tutorial and using Pycharm as IDE. When I run the command from the internal Pycharm console: from polls.models import Question it returns me the…
-
1
votes3
answers84
viewsTwo classes in a Register screen
-2 I’m starting at Django, and I have some questions: 1° In the code below, as you can see, has a class called Student that has relationship with the Responsible class, I would like to show in a…
-
1
votes0
answers342
viewsUncaught Referenceerror: alerta is not defined
Hello, I have an undefined function problem in a code snippet. I’m using Django, but when I try to call a function occurs the undefined function error index.html {% if valueStatus == 0 %}…
-
1
votes1
answer246
viewsDropdown with dynamic options in Django form
I have an expense form that has a field to select the category, but I need the options to be obtained from the database. These days this is mine forms.py: from django import forms from .models…
-
1
votes1
answer97
viewsNameerror on Django, but the class ta defined
When rotating the python3 manage.py runsserver i get the bug : Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File…
-
1
votes1
answer184
viewsForm in Django with more than one Model
I’m new to programming and I’m trying to make a form using more than one Model in Django. I even managed to list the Fields of Forms.py, but when asked to save it only records the data of the first…
-
1
votes1
answer82
viewsError when using multiple Bds in Django
Hello I’m studying how to add two databases in Django and am finding a problem. When I use the using in the list method, it can use the database chosen and lists the clients in the template. def…
djangoasked 5 years ago Luan Chagas 13 -
1
votes0
answers24
viewsuser_login does not log last login done
I have a Python login function in the Django framework and would like to add the user_login log when the user logs in to the system. In this case, it would have to use this column already registered…
-
1
votes1
answer343
viewsDynamic Modelform - Django
Hello! I am using Modelform from Django 2.2, and I need to leave the dynamic form. The "Number of installments" field should only appear when the Payment Method is credit. At first I tried to do…
-
1
votes2
answers230
viewsWorking with querysets and Celery
Following what I had asked here, I keep trying to run my code asynchronously. I’m trying to use Celery to perform this procedure, but I’m having some problems. I had the following: def get(self,…
-
1
votes1
answer57
viewsNested Relationships
Guys, I have a question regarding the nested relationship. When my code gets that way: class CategoryListSerializer(ModelSerializer): class Meta: model = Category fields = ['id', 'name',…
-
1
votes0
answers86
viewsMask with Jquery
I applied a monetary format mask and made a specification not to accept the first digit as 0. However, the following characters are still accepted "and, -, +,." Obs: the field is decimal. The mask…
-
1
votes1
answer117
viewsHow to connect a python container Docker to a sqlserver
I want to create a python3 container that can connect to a SQLSERVER, I’m using Django in my application and it doesn’t have a native driver to make that connection. I created an image to configure…
-
1
votes1
answer144
viewsHow to do this kind of relationship in Django?
I have the models "Subscriber": class Assinante(models.Model): name = models.CharField("Nome", max_length=32, null=False, blank=True) phone = models.CharField("Telefone", max_length=11, null=True,…
-
1
votes0
answers43
viewsProblems with Memcached + Django + Celery(Rabbitmq)
I’m having trouble using the memcached + Celery(Django). My program makes a query in a database, through a cursor, creates chuncks with the return of the bank and sends these Chunks to be processed…
-
1
votes1
answer141
viewsHow to update Forms in Django
Hello, everybody. Here’s the thing: I have two presses that integrate with a model in Django, being them: Forms.py from datetime import datetime from django import forms from .models import…
-
1
votes1
answer66
viewsI cannot change the verbose_name of a field
I am programming an agenda, and for that, I created the model "Commitment", which has the following code: class Compromisso(models.Model): nome = models.CharField(max_length=100,…
-
1
votes0
answers226
viewsHandle POST elements in Django Rest Framework
Good night, I own a model with: camid = models.AutoField(primary_key=True) A serializer: class CameraSerializer(serializers.ModelSerializer): class Meta: model = Camera fields = ["camid", "nome",…
-
1
votes0
answers37
viewsHow to change a form dynamically?
I have two models, Empresa and Funcionario. I would like when the user selects the company the employees are dynamically set in the employee form as both Forms will be shown on the same page. So…
-
1
votes1
answer129
viewsFiltrar Foreign Key
Good afternoon...I’m trying to make a filter through Foreignkey, return only items that are not included in the registry of allocations, I’m using Select2...but I can’t filter... I have 3 models:…
-
1
votes2
answers102
viewsHow to relate two classes in the same Model Django
hello, I am new to Django and I am trying to get information related to two different classes, with 1 variable as "base" for it. In case I have the Customer and Order class, and I would like to…
-
1
votes1
answer249
viewsCreate permissions on Django
I was trying to create a permission for my template but I couldn’t. I did some research to know how to do it and I’m not getting it. basically would like a permission similar to what Django has for…
-
1
votes1
answer149
viewsHow I treat a table in html as if it were a form
I am developing in Django an application for procedural research and it would be made based on excel spreadsheets. I found on the internet tutorials to select the table rows, however, I do not know…
-
1
votes0
answers80
viewsFunction that works on Edit/Django but does not work on the/Django wiki. Why?
I’m trying to make a feature to edit wikis. When I enter Edit/Django it returns me all right, but when I enter the wiki/Django, for example, where you have the edit button, it returns this error:…
-
1
votes1
answer110
viewsHow to pull a Foreignkey from the models on Django?
Hello I am developing an application and I have a problem, if someone knows how to solve. I created the following models: class Cliente(models.Model): user = models.OneToOneField(User,…
-
1
votes1
answer161
viewsHow to use a Python function in Django
I’m currently having a problem where I haven’t found any solution that I’ve been able to understand and execute. I will be summarizing here the scope of what I need, otherwise it would be very…
python-3.x django django-templates django-rest-framework django-querysetasked 4 years, 2 months ago Bruno Marques 21 -
1
votes0
answers30
viewsProblems with Count method in a Django queryset
I’m in a strange situation with Django and Count method, I have a queryset that I called ranges and then I have a variable qtd_intervalo where I store the intervalos.count() then I do the tests: if…
python django web-application method viewmodelasked 4 years, 2 months ago Artur Fernandes de Souza Filho 21 -
1
votes1
answer54
viewsI have Jango in python Anyhere my view that generates pdf works locally but on the error server!
Hello, I have a system in Django/python very simple to manage sweepstakes, and last xhtml2pdf to generate reports in pdf, when ultilizo it locally it works perfectly did the deploy in python…
-
1
votes0
answers34
viewsNoreversematch with Keywords Arguments even if there is a route
I am trying to send an id to the url using Xios with the following line: const request = axios.put("{% url 'forms:save' card_id=card.card_id %}", this.body_text_value).then(response =>{…
-
1
votes0
answers75
viewsHow to perform a Queryset returning the biggest date with Django
I’m trying to perform a Queryset using Django, I want to return the most recent dates present in the database, along with the other fields, where I used the prefetch_related(). However, the use of…
-
1
votes1
answer30
viewsStatic no Django
People, Wanted advice or help on the 'Static' in 'Django', my files that are in the 'Static" folder they are not loaded presenting the following errors below: System check identified no issues (0…
-
1
votes1
answer66
viewsWhen passing JSON object received from DJANGO to Datatables with Javascript the table is not populated generating infinite processing
I am performing the passage of lines that will compose a table in the Datatables pattern through Django. If I do the DOM insertion, I can handle it by calling the Datatables function via JS. The…
-
1
votes0
answers46
viewsDjango: Entity Relations and Data Update
Hello, everyone, I have a Django project that issues daily reports of a company’s activities. The project is a bit complex, but I’m going to give you a simple example of a relationship that’s…
-
1
votes1
answer27
viewsHow to update "deleting" objects from a nested object?
I have these two models to follow: class Questionario(models.Model): numero = models.IntegerField() nome = models.CharField(max_length=300) class Meta: db_table = 'questionario' verbose_name =…
-
1
votes1
answer40
viewsValueerror: Cannot assign "<class 'calendario.models.Shopping'>": "Parceling.shopping" must be a "Shopping" instance
I am trying to create a table of installments, in which the user will inform the purchase value, input (if you have), the amount of installments and the date of purchase. With this data I have to…
-
1
votes0
answers34
viewsError 403 - Google API - Classroom
I have a python script that creates and links students from a certain list of Class room classes in Google via API. The problem I’m having is the following, the student and inserted in more than one…
python django google-api google-api-client http-status-code-403asked 3 years, 9 months ago Romulo Ferreira Mesquita 7 -
1
votes1
answer26
viewsError running makemigrations on my Django project
I am trying to run makemigrations on my Django project but it is returning error saying that the argument default is not expected or something like, follows part of the error: TypeError: __init__()…
-
1
votes0
answers17
viewsMixin Django Class Based View Python3
Good morning guys: Problem = add a new functionality via a mixin in Jango for a CBV. reason = I want to create two records in two different records. Trying = class CreateUserMixin(object): def post2…
-
1
votes0
answers56
viewsDjango Model Queryset - Insert record if it does not exist with only one query
I’m starting to use Jango and its ORM and I came up with a question. How can I check if the record exists in the database and if it does not already exist? This with only one query to the database.…
-
1
votes0
answers14
viewsHow to change field location in Django?
When we register our models on admin.py from Django they are shown as follows:: @admin.register(Beneficio) class BeneficioAdmin(admin.ModelAdmin): list_display = ('nome', 'situacao') They will be…
-
1
votes0
answers16
viewsHow to view and define values for a model using the Django template
Django has HTML files that we can override, one of them is called app_list.html, which has the following code: {% if app_list %} {% for app in app_list %} <div class="app-{{ app.app_label }}…
-
1
votes1
answer30
viewsDjango: How to prevent date field conflicts in admin
In a record of a Vaga inside the Django admin I have two fields: data_inicio and data_fim. But I wish it wasn’t possible to put one data_fim less than data_inicio, and I don’t know how it can be…
-
1
votes1
answer30
viewsInitial Form Django is not working properly
Well I am developing an application in Django and I am trying to use jquery with Django to make a request to Viacep to consult the cep that the person typed and left the focus of the field that was…
-
1
votes2
answers58
viewsRecover database data on Django
My project is a simple table showing countries, number of covid cases, deaths and recoveries. By Django admin I have already registered two countries and now I want to recover this data and show on…
-
1
votes1
answer51
viewsPerform the action of a form without updating the page on Django
I am developing a project where I need to add members to a group, for this, I go through all registered members and present them in my html template. Each member has next to the "add" button only…
-
0
votes1
answer251
viewsProblem with Django authentication
I’m having trouble validating the login, I’m using a legacy bank Firebird 2.5. Could someone help me?…