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
answer80
viewsDjango showing error 500 instead of showing error 404
My file views.py: def handler404(request): return render(request, '404.html', status=404) def handler500(request): return render(request, '500.html', status=500) My file urls.py: handler404 =…
djangoasked 5 years, 8 months ago Thiago Krempser 1,878 -
0
votes1
answer66
viewsAccess user data via Django template
I have the user model that I extended from the Django standard class TradingUser(User): avatar = models.ImageField(upload_to='images/', default='images/none.jpg') Only when I try to access this…
-
0
votes1
answer62
viewsHow to make a date Slug?
I’m trying to add a Slug that converts the date to a tip that html accepts, but I don’t know how to make it work. on the models.py part class Por_dia(models.Model): pedidos =…
-
0
votes1
answer697
viewsRender items with Django Forms. Three Models involved, unico Forms
Hello, I’m having doubts to render my model’s items. The system works as follows: User taking an exam Exame. Within each exam has the types of exam ItemExame User generates a report Laudo that pulls…
-
0
votes1
answer769
viewsYou can return the id of the last data registered with Django Model Form
Guys, I have a question. I’m using Django and I wonder if you have how to return the id of the data registered with Modelform, example when you give a model.save() can recover the id of this guy who…
-
0
votes1
answer57
viewsError creating Django filter
I am trying to create a filter but get error: Related Field got invalid lookup: icontains msm if I use the related_name before the attribute n works. class…
-
0
votes0
answers148
viewsException has occurred: Variabledoesnotexist - Django
Hey, guys, I got a mistake I can’t figure out why. I am creating a simple web client registration app with Django, I am using vscode with text editor. When I start the application the error…
-
0
votes1
answer41
viewsDjango REST Swagger - Gera 2 GET methods
I am implementing a REST API with Django REST Swagger 2.2.0. For a given endpoint I have defined that the following methods are available: http_method_names = ['post', 'put', 'get'] However, in…
-
0
votes0
answers246
viewspermission of Django
Good afternoon, I am wanting in the template to make a loop to disable a button according to the custom permission .. The model code is: # -*- coding: utf8 -*- from __future__ import…
-
0
votes1
answer140
viewsReportlab in Heroku - Word error with accent
I’m generating reports with reportlab But when there are words accentuated, I’m taking 500 Internal Server Error in the Heroku. Localhost works just fine. I tried the next one didn’t work out…
-
0
votes1
answer14
viewstemplates extends from project to apps
I have a project created from startproject ... command where in the structure of it, I created a templates folder, in which, I wish to have templates htmls bases, ie extending them to the templates…
-
0
votes1
answer405
viewsDjango formset, calculate total with Jquery
I have my order items being displayed with formset, the quantity and price columns are editable. I’m having trouble calculating the total after changing the price or the quantity. I can identify the…
-
0
votes1
answer22
viewsProblem: No name 'departments' in module 'funcionario.apps'
I cannot pass this phase because when compiling it presents the error : No name 'departments' in module 'funcio.apps' from django.db import models from django.contrib.auth.models import User from…
-
0
votes1
answer227
viewsWhat are Django’s view, serializer and model settings?
I’m studying the 'Django' and would like to understand the definitions view, serialize and model and which route between them. Thank you
-
0
votes1
answer122
viewsSlow loading of files into Static folder in Django
I am learning Django and I noticed that the static files take time to load, example; I have a css file that defines the style of the home, I change the font color and update the page and nothing…
-
0
votes1
answer644
viewsHow to change data using Forms. Form on Django
Good afternoon guys, I made all my form using (Forms.Form) only that I am not able to create a function to edit the form data. Below is my code: (I am using the same registration form template)…
-
0
votes1
answer84
viewsSet attribute of another Python class
I am studying python and would like to understand how I can define an attribute of a class based on attributes of another class. I’ll go to the example to be clearer, it’s just an example of what I…
-
0
votes1
answer295
viewsdef post(request): or request.method == POST?
I’m doubting the title above about the best development practices in Django/python. Example: class Exemplo(View): def get(self, request): pass def post(self, request): pass OR if request.method ==…
-
0
votes2
answers791
viewsDjango Models - Foreignkey how to call method within the class by Admin
Good afternoon Galera, My situation is as follows. I have a nested class structure for a solution and I’m stuck in the following situation: I have these class structure: class…
-
0
votes1
answer70
viewsSET TIMEZONE in raw query
The raw query below shows the following error: query = Resume.objects.raw(""" SET TIMEZONE='America/Sao_Paulo'; SELECT id, datetime_now FROM resume; """) raise AssertionError("database connection…
-
0
votes1
answer28
viewsGeneric relationship between model Logentry
Someone has worked with Auditlog on Django ? Documentation of Django Auditlog Let’s say I have this model: class Cadastro(models.Model): nome = models..TextField() auditlog.register(Cadastro) I…
-
0
votes1
answer90
viewsMidia Object has no attribute 'get_absolute_url'
Has anyone ever had that problem? Attributeerror at /midia/create/ MODELS: from django.db import models from django.core.urlresolvers import reverse from django.utils.text import slugify class…
djangoasked 7 years, 4 months ago Michel Spirlandeli 1 -
0
votes1
answer57
viewsDjango application (NGINX and WSGI) consuming only one core, reaching 100% and locking
I have a problem that I have deployed with NGINX and UWSGI on a debian 9 with 24 cores, the application is simply running correctly, but when I upload an excel file the application is using only one…
-
0
votes1
answer104
views"Column 'model_id' cannot be null" Django Cascade
I’m having a problem deleting 2 Foreign Keys from a Foreign key. I’ll explain further: This is the hierarchy of the credit card model I have: Creditcard Customer Address Phone I’m trying to delete…
djangoasked 7 years, 4 months ago Guilherme IA 1,414 -
0
votes0
answers213
viewsDjango Error - Unicode Decode Error
When trying to create an App in Django with the command django-admin.py startapp Name, such command raises the following error : Traceback (most recent call last): File "manage.py", line 22, in…
-
0
votes1
answer1333
viewsError creating python mkvirtualenv virtual environment 3.6
After installing python 3.6 and then virtualenvwrapper via Pip (Pip install virtualenvwrapper-win), I tried to create a virtual environment by the "mkvirtualenv name" command and the following error…
-
0
votes1
answer21
viewsPassword field via ajax in Dajngo
Hello, I want to fill the password field of my model Company in sending the value typed via post ajax, I saw that there is the Passwordinput widget when using modelform but I did not want to use…
djangoasked 4 years, 8 months ago Wilker De Sena Guedes 23 -
0
votes3
answers78
viewsInsert a list into a database made with Django
Hello, I want to insert a list of names in a database I created with Django, but I’m not getting it. Is there a method to enter all names at once? (NOTE. I have already performed the makemigrations…
-
0
votes0
answers21
viewsMultiple Model Authentication in Django
I am developing an application with Django 3, in it I have the candidate model and the company model that have login and password as fields. The idea is that the candidate model and the company…
djangoasked 4 years, 7 months ago Wilker De Sena Guedes 23 -
0
votes1
answer717
viewsSelect widget in Django does not appear in the form
my signup page is not showing the selection fields, my code is as follows: Forms.py class InscricaoForm(forms.Form): VINCULO = [ (u'b', u'Bolsista'), (u'e', u'Estagiário'), (u't', u'Terceiro'),…
-
0
votes1
answer50
viewsShould I upload to my Git repository the static files generated by Django’s collectstatic?
After generating the static files from my web app using: python manage.py collectstatic I am in doubt if I should send or not the content generated in the directory static/ to my repository. It’s…
-
0
votes1
answer87
viewsPython rest_framework how to change URL?
How can I change the urls in rest_framework on Django? The router defaults to using the creature ID in the URL ex. /api/Creatures/1/ I want instead of appearing the ID, appear the name of the…
-
0
votes2
answers766
viewsLoad image in html from saved path in Django database
I’m trying to make a newspaper using Django and Mysql database and now I need to list the news images: In my database I have saved the image path, because I thought it would have a better…
-
0
votes1
answer161
viewsDjango Runserver
Greetings Galera, Ando having a problem with the Django framework: initially could climb the server normally, but after a while, when running Manage.py, the server does not "go up" and the command…
-
0
votes1
answer563
viewsSend form Django
I’m new to python and I’m trying to register, when I click to send nothing happens, no post py views. from django.http import HttpResponse from django.shortcuts import render from…
-
0
votes1
answer108
viewsSearch problem using Django queryset when editing
I am glad for the help, because I am not able to carry out this search, even performing the search, returns me the right id (id_sector and id_company) but Django does not recognize or I am doing…
-
0
votes1
answer39
viewsHow to calculate the frequency the data appears on Django?
Hi, I’m making a search bar with filters, in it the user can choose whether to sort by frequency or sort by another field (which is ordering everything right), what gives problem is when searching…
-
0
votes1
answer44
viewsHow many Apps can I have in a Django project?
I’m studying Jango a little while ago, and recently seeing a third party project, I saw that apparently he had more than one app, with this raised me the following doubts, can I have more of an app…
-
0
votes1
answer43
viewsdelete a key from Django’s bank
When I delete this column from the table, Django shows me an error, so I understood this key is stored in the bank, is that it? And to delete not only remove line 57 (marked on image) Finally how do…
djangoasked 3 years, 11 months ago Luciano Lopez 11 -
0
votes2
answers43
viewsDjango - DATABASES configuration
DATABASES = { 'default': { 'ENGINE': 'sql_server.pyodbc', 'NAME': 'name', The string of ODBC only use the attribute DATABASE, but Django only executes with the attribute NAME. How can I resolve this…
-
0
votes1
answer12
viewsSasscss Undefined variable using RGBA
When I try to use a variable from a file . scss, with one variable it works and another not: _templateColors.scss $blue-dark : #0277bd !important; $gray-light : #f5f5f5 !important; $gray-dark :…
-
0
votes1
answer94
viewsImport: No module named manages.alert.views
I am trying to use the following function defined in gerencia/alert/views.py def maLogger(level, message, node=None): aux=0 if level=='Critical_client': aux=2 date = datetime.datetime.now() log =…
-
0
votes1
answer123
viewsUnidentified session in some logins on Django
I am doing a maintenance on a Django app version 1.5 with DRF 2.3. This app features off-the-shelf user authentication that works well. See a summary below: Accounts/views.py class…
python django python-2.7 django-admin django-rest-frameworkasked 7 years, 2 months ago Kaio Cesar 305 -
0
votes1
answer1564
viewsHow to use token to validate a Django Rest Framework user login
Hello, I’m a little lost when authenticating a user by Django-Rest-framework, I was following the tutorial of the channel Codingentrepreneurs in the video 32 of the Blog API…
-
0
votes1
answer43
viewsDjango - add user as team member in view
How to allow a user to register to already become a team member through their own view in Django? I tried it this way, but nothing happened. py views.: def cadastro(request): form =…
-
0
votes1
answer23
viewsFilter model datetime Django
I have a model that is basically the following : class Sample(models.Model): date = fields.DateField(auto_now=True) Now, with this I want to filter only the month in this model How I only get the…
-
0
votes0
answers19
views[@action Django restframework ]: execute commands when a new client is registered
good night. I am developing a customer registration API, and I would like it that every time a new client is registered, runs something, and I tested a code and it didn’t work. someone can help me?…
-
0
votes1
answer46
viewsPython-Django - How to show template only items associated with logged in user
I have a small project that is an "to-do list", or to-do list, done in Python-Django and I will implement a login system as I have done with other projects. However, this time I wanted to show only…
-
0
votes2
answers878
viewsGet data from Django view
When registering a new user he chooses which group he is part of through a select. Each group has a responsible person, how do I get the email of this responsible person to send an access request…
-
0
votes0
answers14
viewsInvalid Django form after . read()
My code is like this Em Views: def cadastrar(request): if request.method == 'POST': arquivo = request.FILES["imagem"] leitura = arquivo.read() if form.is_valid(): form.save() The form is saved only…