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
votes2
answers158
viewsDjango Staticfiles not found css does not load
I am developing a Jango application, everything is running perfectly, but the static file is not being rendered on in my Catalog. I made the settings in Settings but it still doesn’t work. below is…
-
0
votes1
answer157
views'utf-8' codec can’t Decode byte 0xe1 in position in rendering html
Greetings to all. I am trying to render an html file with Python/Django and am getting error "'utf-8' codec can’t Decode byte 0xe1 in position" because of a sharp comment. The problem wouldn’t be…
-
0
votes1
answer41
viewsShow internet image in my Django app
Hi, I’m learning to use Django. I wonder if you have any way to reference static files that are not saved on my server. Example: In this way HTML works: <img {% Static 'name_da_imagem_here.jpg'…
-
0
votes0
answers18
viewsHow to modify State selection using STATE_CHOICES on Django
have a SearchModelForm in my file forms.py in Django with the following code: from localflavor.br.br_states import STATE_CHOICES class SearchModelForm(forms.Form): name =…
-
0
votes0
answers30
viewsDjango Rest Framework + React I can’t return the Cookie
I’m starting with Django and React development. I tried to make a User Authentication page. When loading the User Registration page I call the API in Django to return the CSRF via Cookie and then I…
-
0
votes0
answers30
viewsDatabase - Relationship - Research
Hello, guys, I’m doing a Django project and I have a question about the modeling of entities. In my project, one person can take on multiple criminal records. One day she may be a saleswoman for the…
-
0
votes1
answer33
viewsFormat timedelta in Django template
I’m having trouble presenting the uptime time of an equipment, Django automatically shows in the following format: I would like to present this time value in Portuguese. in the settings.py Timezone…
-
0
votes0
answers141
viewsHow to pass DJANGO (Python) variable to javascript
People. I have a problem where a friend is backend in DJANGO and I frontend in Javascript. I would like to know how to pass a variable from a Django array to Javascript. I’m trying to create a…
-
0
votes1
answer35
viewsHow to create this type of relationship using Django Models
After seeing a modeling that I should implement in Django, I was a little confused and I will explain what I tried to do and what was sent to me. The following image is the relationship I should…
-
0
votes0
answers88
views'Object of type 'type' has no Len()' in Django
I am trying to filter the data from a list between two dates and I received this error. Models py. class Data(models.Model): dev = models.ForeignKey(Device,…
-
0
votes0
answers51
viewsStack objects as a multiple item selector with html and css
I have a list of words I want to stack in columns to save and use the left place in an html file for a Django project: I’m not very good at web development, feel free to explain to me as a 10 year…
-
0
votes0
answers18
viewsHow to change inlines according to an option in Django admin
Currently I have the following code: @admin.register(Experiencia) class ExperienciaAdmin(admin.ModelAdmin): list_display = ('tipo', 'data_inicio', 'data_fim') inlines = [AcademicoInline,…
-
0
votes1
answer21
viewsDjango Rest Framework does not filter after resetting queryset
My url will be something like.../? search=modal. I want to replace the "modal" with empty "" so that clean the filter and return all records. Views.py class…
-
0
votes1
answer18
viewsDjango - Standalone - How to validate value received from a Foreign key field?
I am working on a Django project whose purpose is to take advantage of models for both forms and frontend views and for a separate service. For this I found a way to transform/use Django models with…
-
0
votes0
answers19
viewsHow to run a scrapy + Django on Runtime without getting error?
I have a scrapy with 2 Spiders that when running from the command line works perfectly without errors. However, when I call through the application occurs the following: 2021-02-09 12:31:39…
-
0
votes1
answer123
viewsValidate csv file in Django
I am trying to insert a function to validate the upload of a . csv, but when placing it the following error was presented: ImportError: cannot import name 'PresencaProf' from partially initialized…
-
0
votes0
answers28
viewsValidate upload by csv only
I have a small form where I ask the user to insert a csv file, however if the user inserts a file with different format he simply lets it pass. I’ve tried everything, but I’m not getting it done.…
-
0
votes0
answers109
viewsHow to pass parameters to a Django url using javascript
I am new to the stack overflow platform and also in web programming, I am trying to build a program for restaurant. In my views, I sent two models of Django (Product and Table), these tables have no…
-
0
votes0
answers13
viewsHow to show additional options after filling a Selection box in Django Admin
When trying to register in Django Admin I have three fields to fill out being them tipo_remuneracao valor and valor_max, however depending on the type of compensation I may need to show value and…
-
0
votes1
answer37
viewsValidate upload of csv files
I have a form that one of the fields asks for a file. The point is that only files . csv should be allowed, but I’m not getting the validation. Follow the code below with my last attempt. Filing…
-
0
votes1
answer34
viewsHow to format money fields in Django?
I have a field in my admin Django that receives a real value, but I would like that value to be formatted and not receive more than two decimal places. I tried using a javascript to modify the…
-
0
votes1
answer43
viewsI have a problem in the relation between two tables in Sqlite using python/Django
I am making a simple CRUD, using 2 tables, the default user of Django and the citizen I created, I am using a foreinkey username to link the two, but in the form, instead of appearing a username…
-
0
votes0
answers20
viewsHow do I generate and consume fakers data in my Django app
I wonder if there’s any way to generate a mass of false data based on my model. I don’t want to have to keep registering one by one to have a reasonable amount of data to work with. For example,…
djangoasked 3 years, 8 months ago danilomarto 59 -
0
votes1
answer15
viewsHow to put the validation rule only when saving and not validating in the update in Django admin with python?
I am developing in Django the following application of course management, in the register of a class I have a registration informing the amount of vacancies for doctors and academics, and in the…
-
0
votes0
answers59
viewsNoreversematch in Django
Hello I have a problem in Django that cannot solve a url with parameter (Django.urls.exceptions.Noreversematch: Reverse for 'incluNaRota' with Arguments '(',)' not found. 1 Pattern(s) tried:…
-
0
votes0
answers15
viewsHow to view the value of a selector in Django’s Forms.py?
I have a field that must be validated from a selector that is a foreign key in the model. py.models class NyModel1(models.Model): field1 = models.CharField(max_length=50) description =…
-
0
votes0
answers27
viewsDjango.db.utils.Operationalerror: Foreign key Ismatch when trying to change the primary key
Django automatically creates an Autofield for primary key if there is no field with primary_key=True, so I’m trying to remove the primary key I created (identifier field in the Client model) and…
-
0
votes0
answers24
viewsCount and length in Texas
Hello, everybody. I have a Django project and one of its features is to generate statistical numbers. For example: I have an employee model and it has boolean fields, like, whether it is active or…
-
0
votes1
answer46
viewsintegrate Slick slider to my project
I’m trying to integrate Slick into my project Django but it seems that it doesn’t work at all, if you can help me by telling me what I’m missing, it would help me a lot, I’ll put the base code and…
-
0
votes0
answers24
viewsAuthentication Django login returns 405 after logging in
The login page after being filled should redirect to the page that requires authentication but returns in the console "POST /login/ HTTP/1.1" 405 0 and in the browser returns to blank login page.…
-
0
votes0
answers62
viewsList users contained in the Django group
I followed the explanations of a page to create a group and add users to the group. But now I want to list the users contained in the group and show in html html tried some variations but no return…
-
0
votes1
answer22
viewsUsing Loginrequiredmixin with Login Formview
Basically, I have a Formview where I do validations to log users to my platform, if the result is positive, it is redirected to the URL /dashboard/, as shown in the code below. class…
-
0
votes1
answer51
viewsSqlite database conflict when merging into git
I’m working with someone else on a Django project and she owns the main repository. I have a Fork from this repository and want to update it with the original. I created the upstream: git remote add…
-
0
votes0
answers19
viewsDjango Favorite view
I’m trying to create a favorite button for an app’s posts, but I can’t figure out how to create one because it contains an entire number. When the user clicks on the favorite button. The button will…
-
0
votes1
answer27
viewsPython Django heritage with Unique attribute
I’m in a little trouble. class Pessoa(models.Model): cpf = BRCPFField(**unique=true**) class Aluno(Pessoa): novo_atributo = .... class Instrutor(Aluno): outro_atributo = ... class Gestor(Pessoa):…
-
0
votes1
answer64
viewsHow to add values from one model and insert the result into another using Django?
I have this model that aims to register the available services and their respective values: class Servico(models.Model): nome = models.CharField('Nome do serviço', max_length=255) preco =…
-
0
votes0
answers23
viewsFailed to start gunicorn.service: Job for gunicorn.socket failed . Ubunto 18.04 TSI
Hello guys I am in need of help with this situation because I have tried several solutions and for my current level of experience I am not able to fix this error and deploy in the app. I’m following…
djangoasked 3 years, 7 months ago Guilherme Santos 1 -
0
votes0
answers12
viewsReturn data with CBV using parameters in the Django url
Good evening. I am trying to return the data of a query, and even managed to make the query work. The problem is when to send the data to the template. Always appears the error that has to be a…
python django url framework django-generic-viewsasked 3 years, 7 months ago Sergio Sacchetti Junior 55 -
0
votes1
answer30
viewsDjango Oauth2 Facebook autentication
When trying to include facebook login authorization on my site, I followed the steps taken in Django and similar documentations. And doing step by step, including the app in Settings…
-
0
votes2
answers22
viewsDjango queries Related Objects
So with two models created : class Questao(models.Model): texto = models.CharField(max_length=220) quiz = models.ForeignKey(Quiz, on_delete=models.CASCADE) created =…
-
0
votes0
answers29
viewsHow to add user types in groups in Django?
I rewrote the User Django model for CustomUser using AbstractUSer adding two booleans, such as is_admin and is_insurer. Moreover, two groups were created programmatically: admin_group and…
-
0
votes1
answer25
viewsdisplay a single Django class value
I would like to know how to show in my html template, a single character of my model "Character". this is my models.py, I inserted 10 characters in this class via Django admin: py models file. from…
-
0
votes0
answers17
viewsRequesterror 400, 'search_phase_execution_exception', 'failed to parse date field Django
I’m having trouble executing the views that receive an Elasticsearch, searches between dates coming from the template and returns a csv! views: ... data_inicio_template =…
-
0
votes0
answers23
viewsDjango Session permitted for user
I have a Django application that registers a user, using the Django User table. Everything of that scope is working but there have to be restrictions. When accessing username1 account and username2…
-
0
votes1
answer21
viewsDjango - How to interact 2
In Form1 I have this entry "name_car". This form saves normally in the database. In form2 I have the same field "name_car" to put the "pieces". Question: How to bring the Form1 car name to the form2…
-
0
votes1
answer18
viewsHow to use "Objects.filter" by selecting only the logged in user in the application?
I am using Django authentication and in HTML templates works very well when I use for example: {% if user.is_anonymous %} ... {% else %} ... {% endif %} I would like to use this same "user", which…
-
0
votes1
answer50
viewsLoad multiple functions on main page using Django
I’m having a problem trying to load some data from mysql database using Django, type functions only work if I assign in the file: py. the following attribute: path('', views.countregistered) But…
-
0
votes0
answers27
viewsDjango.urls.resolvers.URLResolver. _reverse_with_prefix() argument after ** must be a Mapping, not set
Hello I’m trying to do an e-commerce with Django, I was following a tutorial until the creation of the products, the page worked ok (no products and categories), when I added a category and a…
-
0
votes1
answer18
viewsInline formsets Django
Hello, I am until that experienced in Django but I am having an error that I am not able to solve, well the error is this, I have an inlineformset_factory and when I go to save it not saved and says…
-
0
votes2
answers29
viewsRecent version of Django with SQL Server
Hello, I’m starting with a project where I will use the Django framework, and due to the nature of the project, I would like to use SQL Server (because I am more familiar), however, everything I…