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
-
0
votes1
answer132
viewsDo not select in case of null value in the database field (Django)
Eae guys, I’m having a problem, I’m making a script that randomly selects database users: select = User.objects.filter(status=0,…
-
0
votes1
answer78
viewsI can’t display a comment list for a post in the Django template
I have a method called get_comments in the models that returns the comments of my post, but when I display in the template, only the posts are displayed, the Comments are not. Django does not return…
-
0
votes0
answers25
viewsSet a Datefields Arrayfield
I need to store several dates in a Django model (I’m using version 2.1), I was able to create several fields, thus: date1 = models.DateField(null=True, blank=True, verbose_name="Data da parcela 1")…
-
0
votes1
answer225
viewsHow can I manipulate data from a form in Django?
I’m a beginner in Django and wanted to know how I can manipulate data sent by the form. I have the following form: class CreateNewUser(forms.Form): Nome = forms.CharField(max_length=200) email =…
-
0
votes1
answer78
viewsI cannot get the correct item id as parameter
I have an app django of posts (posts) and comments from posts. In it I can also delete one post, however while deleting a post the application only deletes the post with higher id. The same occurs…
-
0
votes1
answer88
viewsSave files via upload to the folder configured with the stipulated name
I am in development environment, and would like to record an image by placing it after upload in a folder that I have configured locally on my machine like this: MEDIA_URL = '/media/' MEDIA_ROOT =…
-
0
votes1
answer79
viewsHow can I get access to deleted objects in Django?
I’m developing a parking management system in Django that registers the 'Vehicle' object according to its time of entry, and calculates the value as it goes, but I need to develop a reporting system…
-
0
votes1
answer361
viewsError trying to initialize a cloned Django project from github (Modulenotfounderror: No module named 'django_filters')
I am trying to run on my pc a Django project that I cloned from github, but if I try to run the command 'python Manage.py' returns me the following error: File "Manage.py", line 16 ) from exc…
-
0
votes1
answer344
viewshow to do total in list elements Python Django
Enter primary data (raw data)where it has values . Flot and I am already calculating the total in function "totalv2" ta run class Funcionario(models.Model): Custocoleta = models.Decimalfield(…
-
0
votes1
answer61
viewsInsert direct tuple with SQL in a Django view
I’m using Django in two projects (let’s call Project1 and Project2) that relate and share the same database, but because they are different projects, they do not share the same apps. Now I need to…
-
0
votes1
answer95
viewsDjango ORM to select with group by
I have a very simple model in Django: class TrackService(models.Model): ip = models.CharField(max_length=150, db_column='nm_grupo') creation_date =…
-
0
votes1
answer59
viewsGenerate a context from another instance in Createview
Hello! I need to render a context in the Createview template. no requeste to passing an id, and I want to put the name of that id in the Createview template py.url urlpatterns = […
-
0
votes1
answer63
viewsDjango, special characters for HTML with content saved in the database
Good morning, I have contents saved in HTML database: Field: content <p><img src="/media/django-summernote/2019-08-26/2ed93bb9-8293-4b98-9ccb-eeba931421b5.png" style="width: 255px; float:…
-
0
votes1
answer486
viewsProblems with Urls in Django
Expensive, I’m with the following mistake my project: django.core.exceptions.ImproperlyConfigured: The included URLconf 'api.urls' does not appear to have any patterns in it. If you see valid…
-
0
votes1
answer404
viewsForeignkey of two tables in Django
Fala, Povo! I have the following problem: I am developing a site for a store that also performs services. Then I have the Shopping and Sales Table (Saleorbuy) and the Services Table (Service) For…
-
0
votes0
answers38
viewsDjango form that varies according to another form
How do I create a form in Jango of an object and that the price of the object varies according to the size of the object without having to update the page. #py.models class Pizza(models.Model):…
-
0
votes1
answer658
viewsRender JSON data received from an API in an HTML/Django Table
Friends, I need your help! I am new to Python/Django and I am doing this project with the knowledge that I acquire in day-to-day studying. I have a function in my views.py that communicates with an…
-
0
votes1
answer904
viewsError Noreversematch
Hello, I have the following error in an application in Django. Noreversematch at /Row/Details/2 Reverse for 'get-weatherdata' with keyword Arguments '{'rowId': 1, 'sensorId': 1}' not found. 1…
-
0
votes2
answers115
viewsHow to return attribute value X - in a Manytomanyfield
I have some classes that relate to each other. Ex: I have an Activity class that has a M2m relationship with an Activity class. And I have another structure class that has a 1to1 with…
-
0
votes2
answers479
viewsHow to filter items in the Foreign key field of the Django form?
Good evening! I’m new to python/djagno, and I’m new to the community, too, that’s my first question. What I want to do is filter the items from a selection list of a Foreign key (Template) on the…
-
0
votes1
answer509
viewsHow to Serialize more data from more than one table in Django Rest-framework
Speak People! I am the following problem: I have a buy-and-sell schedule: class SalesOrBuy(models.Model): client = models.ForeignKey(Client, null=True, on_delete=models.CASCADE) mode =…
-
0
votes0
answers259
viewsMatplotlib.pyplot with Django
I’m trying to insert a graph through the matlib.pyplot library, but I can only upload it externally by inserting it into Jango. I want to insert it as a loaded image, that when receiving data from…
-
0
votes0
answers51
viewspython - error in parameters
I did the initial procedure I saw in a forum, give name to the app, but did not solve, returns that I passed 3 parameters and is waiting for two. from django.urls.conf import include from…
-
0
votes2
answers1309
viewsHow to make Redirect on the page with Django
How to redirect passing an object as parameter in Django already tried redirect() and HttpResponseRedirect but I can’t send an object to page in Sponse, every time I hit F5 it wants to resend the…
-
0
votes1
answer108
viewsSend input to save to JSON file
I have a screen where there is an auto-complete for sale items, the user searches the item by name or code, so far everything works. I need to capture the chosen item and send it to backend (Django)…
-
0
votes1
answer39
viewsSave Timefield as blank
I have a function to save the data imported from excel, the problem is that I have a Timefield that can come blank, and with that I have the following message: Error saving object to database:…
-
0
votes2
answers483
viewsaccess field value within Django template
You can access the values within a variable in Django templates? For example, I have this model: class Avaliacao(models.Model): post = models.TextField() data_inclusao = models.DataField() in the…
-
0
votes2
answers196
viewsHow to display object name in Django template?
Hello! I’m in a learning process of Django, in fact, I started a little while ago and I’m finding it difficult to find a way to display the name of the publisher that is a Foreignkey. Follow the…
-
0
votes1
answer90
viewsTernary condition in Django Templates
I wish I could do that: {% if is_premium > 0 %} <span class="text-success d-block">Você é Premium e possui {{ is_premium }} {{ ' dias' if is_premium > 1 else ' dia' }}</span> {%…
-
0
votes1
answer68
viewsDjango filtering of timestamp transactions
I am having a logical problem trying to perform a data filtering on Django. According to the code below, I am trying to filter an object inside my database: class…
-
0
votes1
answer417
viewsHow do I check if today’s date matches a date created in a Django application?
I have an app that gets the day of the week and the time when an event should occur. In addition, it also receives the period of time that people must confirm presence. My model goes below: def…
-
0
votes1
answer54
viewsProblem sorting Elasticsearch/Django query
I have this model of Django: class Profile(User): rg = models.CharField(max_length=20, null=True,blank=True) cpf = models.CharField(max_length=15, unique=True, null=True) about =…
-
0
votes1
answer433
viewsMaking queries in the bank through form using Django
I am starting studies on the use of the Django framework and I am trying to query the database using a form to return a specific value in the database. Follow my template: <form method="GET">…
-
0
votes1
answer96
viewsDjango connection to sql express 2017
My python version is : 3.7.5 my Django version is : 3.0.2 when I ran the command 'Pip install Django-pyodbc-Azure' it uninstalled my Django version and installed version 2.1 In the file of Settings…
-
0
votes1
answer32
viewsError when adding a text with Django 3, how to fix it?
from django.db import models class Topic(models.Model): text = models.CharField(max_length=200) date_added = models.DateTimeField(auto_now_add=True) def __str__(self): return self.text class…
-
0
votes1
answer98
viewsDjango n:n relationship with grid call
Good night. I am creating a system in Python/Django where I have a relationship n:n between a table Person and another Process and for this I created a third entity called Procedural part. I’ve done…
-
0
votes1
answer662
views'Nonetype' Object has no attribute 'groups'
I’m using a function in mine Templatetagsdjango that basically checks if the user is in the group that has the permission for the given button. The return 'True or False' works well, IE, it shows…
-
0
votes1
answer103
viewsHow to save updates to object via the Django form?
I have an application and when I send the data in the form to be updated it works ( the data are shown in the form) but when I click save the update it repeats the initial data and saves nothing.…
-
0
votes1
answer326
viewsPass view parameters to Django form creator
I have the following application where it is supposed to be possible to edit the details of a selected room. In the file that handles the view I query the database of the selected room for editing…
-
0
votes1
answer164
viewsUPDATE ON DJANGO
I’m a beginner in Django and I’m trying to crud, create, read and delete are working, but the update is not working. Please help me out. This is the page with the data listing: <table…
-
0
votes1
answer103
viewsForm Django Loads Values but Not Saved
I did a lot of research on my case on the Internet and I couldn’t find an answer that fits my problem. Following the tip of JACKSON MOURA in this answer you gave me in another case this one: Doubt…
-
0
votes1
answer56
viewsDjango Filter ignoring characters/symbols
Problem Users who register with the email in gmail can create multiple accounts just by changing the . (dot) place. For example: [email protected] and [email protected] direct to the…
-
0
votes1
answer148
viewsError while trying to create new field in a model in Django
When trying to create a new field in a model while creating an api, I get the following error when running the command runserver: That would be the class: class Person(models.Model): teste =…
-
0
votes1
answer101
viewsUpdate all Fields of a model, except the key Primary
I am starting the studies in DRF and during a test I came across the following situation: it would be possible to change the fields of a class with the exception of primary key? My first attempt was…
-
0
votes1
answer693
viewsFilter and Join with Django ORM
I have 2 tables, one called Formsitems and another called Formstypes. Formsitems has an FK for Formstypes where the type of field that item is indicated. Using SQL I managed to make a Join between…
-
0
votes1
answer337
viewsJavascript is not working on Django
I’ve tried every way, but I can’t make the JS work. login js.: $('.message a').click(function(){ $('form').animate({height: "toggle", opacity: "toggle"}, "slow"); }); login.html; {% load static %}…
-
0
votes1
answer111
viewsDelete without giving error
I have two models, one has the foreign key in the other. I wanted to implement a delete, that would prevent her from deleting that key when she was already safe in a relationship. In the view.py I…
-
0
votes0
answers50
viewsError trying to use a Custom User Model. Attributeerror: Manager isn’t available; 'auth.User' has been swapped for
Hello. Trying to create and use Custom Usermodel when running makemigrations or even running the server gets the error: AttributeError: Manager isn't available; 'auth.User' has been swapped for…
-
0
votes0
answers219
viewsDjango is not reading the Static statistic files
Well, it was all right until a certain moment. Then I don’t know what happened, or if I put something wrong and nothing else is working. Django stopped reading the static files. When I try to enter…
-
0
votes0
answers749
viewsHow to order date column in ascending and descending order?
Good afternoon, I wanted to order a column in ascending or descending order I have a table (the photo attached)I was able to order the title field in ascending and descending order but now I wanted…