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
answer486
viewsDjango.contrib.auth import views || Login Authentication and url redirection
I’m trying to use Django’s libraries to check if the user is logged in, and only then can he log into the pages of my website. I’m coding according to some Internet classes, in his example was…
-
0
votes2
answers510
viewsDisplay the value of a Manytomany Django object in the template?
Hey, sorry for the confusing question (I don’t know exactly how to ask this), but come on. I’m wearing Django2.1. I have these 2 models related so ManyToMany: class Ingrediente(models.Model):…
djangoasked 5 years, 9 months ago Giovane Machado 371 -
0
votes2
answers216
viewsFilter objects in DJANGO - published_date__lte
I’m following a tutorial for modeling a BLOG through the DJANGO . In one of the processes, I create an object with the site posts and order them through the publication date: def post_list(request):…
-
0
votes1
answer418
viewsPersonalized login in Django, what is the best way to improve?
At the moment I need to log in django.admin and login that I myself have created in a models.py | Class Pessoa. In this way it is not functional, because the admin needs to be logged in for a normal…
-
0
votes0
answers81
viewsView.py class in Django
I’m trying to develop a quiz with Django, in my logic I created a class in view.py, but now I don’t know how to reference the methods of this class in the url.py py views. from django.http import…
-
0
votes1
answer130
viewsInsert Alternatives into a Model in Django
Good evening. I’m a beginner in Django, I’m trying to make a simple platform, kind of a quiz and I’m having a question. I have the following class: class Questao(models.Model): subdominio =…
-
0
votes1
answer474
viewsError executing login() 'Anonymoususer' Object has in attribute '_meta'
I’m trying to log into an account of Django to redirect to the main page of my project, but the command login returns me the following error. AttributeError at /login/ 'AnonymousUser' object has no…
-
0
votes1
answer42
viewsHow to show data in the template
I have this model: class template(models.Model): nome = models.CharField(max_length=30) is view: def home(request): dados = template.objects.all() return render(request,'index.html',…
-
0
votes1
answer553
viewsSingle authentication Sign on Django and Grafana
Hello people I am using the iframes of the graphana in my HTML page running in Django/python, however every time I open my page to view the embed Graficos I need to access the graphana and so…
-
0
votes1
answer245
viewsSave . doc file in database with Django
I’m developing an application with Djando and Python. In models.py, to create an object cliente with a name, for example, I do the following: class Cliente(models.Model): nome =…
-
0
votes1
answer1185
viewsHow to request on a server using digital certificate for Python/Django authentication
I am trying to use the api of a system that is available in a web link, however the server of the api requires as authentication a certificate of type pem, I already possess this certificate,…
-
0
votes1
answer105
viewsWhat are the differences between these two ways to save form information?
I am learning how to use Jango forms and I have been presented with two ways to save information from a form in a database. I tested both and both work with validations, but did not understand what…
-
0
votes1
answer445
viewsCommunicate template with view
I have a Django project where I ask the user to enter two dates (initial and final), and through them I make a query in an external database, making an input works, but wanted to take this…
-
0
votes2
answers542
viewsDjango - Questions with Foreignkey
I’m trying to make a form in Django, in which I will save the versions of the projects. Exemplo: Empresa x Projeto 1 Versão 1 Versão 2 Projeto 2 Versão 1 Empresa Y Projeto 1a Versão 1 ... It happens…
-
0
votes1
answer41
viewsElements are not well responsive and functional in bootstrap
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"…
-
0
votes1
answer111
viewsComplex filter with multiplications in the Django model
I have a doubt that I have from the beginning of a project that I am developing and I have not yet found an answer... I have 2 models in my project in Django: class Turma(models.Model): nome =…
-
0
votes0
answers45
viewsValidation with clean method in Django 2.0
In my Model have this method below: def clean(self, *args, **kwargs): valortotal = Venda.objects.filter(id=self.id).aggregate(valortotal=Sum(F('item__produto__valor') * F('item__qtde'),…
djangoasked 5 years, 8 months ago jallisson jallis oliveira band 100 -
0
votes1
answer53
views'<' not supported between instances of 'method' and 'method' Django 2.0
I implemented a validation with two methods def clean(self, *args, **kwargs): #valortotal = Venda.objects.filter(id=self.id).aggregate(valortotal=Sum(F('item__produto__valor') * F('item_qtde'),…
djangoasked 5 years, 8 months ago jallisson jallis oliveira band 100 -
0
votes1
answer52
viewsDisjunction between two types of users using if
Opa, I’m using djando admin for login, by Accounts, and I’m using the User extended to two different tables, Business and User, and I’m doing fully signed up for user.negocio and user.usuario. So…
-
0
votes1
answer413
viewsAutomatic update of the related model through FK - Django
I am trying to use Signal to do a subtraction update on a table based on the value the user selects. an example situation: On the table Materiais I have the pen material with the fields:…
-
0
votes1
answer68
viewsHow to concatenate variables into a Django template
I have a Django magazine that receives data from a table to display the list on the screen, as below: {% block content %} {% for item in itens_lista %} <div class="post"> <h1><a…
djangoasked 5 years, 8 months ago Jorge Gonzaga 15 -
0
votes1
answer256
viewsError when registering user in Django
When I wish to register a new user in Django, I receive the following warning: UNIQUE constraint failed: polls_usuario.matriculaUsuario What might be going on? py views. def registrar(request): if…
djangoasked 5 years, 7 months ago Murilo de Jesus 49 -
0
votes1
answer145
viewsChoices values are being stored like this ['Dog', 'Cat', 'Birds']
I have a system that will have the option of choosing 1 or multiple options in the same field. Bad problem is that I need my field inside the model to be charfield and in Forms to be…
-
0
votes0
answers347
viewsHow to create a function to pass a JSON in the Django Rest framework?
I am studying drf and would like to create a function that would receive a list in JSON format and do an update by serializer. To illustrate better follows as I am thinking. example_serializer.py…
-
0
votes2
answers883
viewsDecimal places in Django template
Good morning, everyone, I’m having a basic problem but apparently boring to solve: {% load l10n %} {% localize off %} var dados_grafico = [ [ 'Entradas',…
-
0
votes1
answer55
viewsDjango - Charfield creates Int field in BD
I have a simple project here, with two models that contain an attribute called phone in both. class Medico (models.Model): nome = models.CharField(max_length=50) endereco =…
-
0
votes1
answer705
viewsLast record of each Django object
I am developing a web application in Python, Django and Sqlite. I have two models, one for "Seller" and one for "Orders". I need to take the last order of each seller and I’m not able to do this…
-
0
votes1
answer417
viewsChange a user’s password in Django, and check that the data provided is correct
I am working on a project in Django for didactic purposes and I am having trouble changing user password in Django. However I already managed to change the password through a form as below: These…
-
0
votes1
answer415
viewsLoading 2 form on the same page and saving them
I have a system, and I need to change, I want to take the pets option, and put it in a separate table, because it will have more than one type of user that would use it. But I’m not getting it to…
-
0
votes0
answers21
viewsDjango - Upload image is not working
On the site already have some questions related to this, but none of them solved my problem in fact. I have a table in the database with a FK table User, in this table I put my image that would be…
-
0
votes2
answers452
viewsHow to get a template that’s in another app on Django
Hey, guys, you okay? So people are starting now to program in Django I’m really enjoying, only a question arose, I wonder if you have how to leave the template html base. as "Universal" what I mean…
-
0
votes1
answer524
viewsCatch id and name via form, both forenig key
Basically the user enters the company profile and makes a comment and a rating. I need the company ID to be passed on this form and I get the ID or User Name I have a system that uses USER extended…
-
0
votes1
answer183
viewsHow to create a view with more than one form in Django
I have model, form and template for units, and in this same template I need to add a region form (these are exams). How can I add this form in the view so it can be edited in the drive template? py…
-
0
votes1
answer143
viewsHow to handle the return of files (PDF) in an AJAX call?
I made a code that selects the documents that are in a bank FTP and by clicking download it runs a AJAX call to the DJANGO where I call the FTP again, download the file and send back to the AJAX.…
-
0
votes1
answer668
viewscss file does not update on Django
The problem is that when starting the site, it loads the css file the first time. But if I edit this file Django does not recognize and continues the same way. I’ve tried a Reload on the local…
-
0
votes1
answer302
viewsHow to remove all items from a Many-to-Many relation in Django?
I have the following models in my Django app: class Tag(models.Model): name = models.CharField(max_length=150) description = models.TextField(null=True, blank=True) created_at =…
-
0
votes2
answers806
viewsApp not compatible with buildpack (Heroku)
I have made other Deploys in Heroku with DJANGO, but this is the first one that I used images and css. From what I’m noticing the site does not accept images anyway, I do not know exactly what is…
-
0
votes3
answers805
viewsI’m having a problem with Django-views, he’s not saving my form
This is my views: from django.shortcuts import render from meusite.forms import CandidatoForm from meusite.models import Candidato def index(request): return render(request, 'index.html')…
djangoasked 5 years, 6 months ago Amanda Sacchi 1 -
0
votes0
answers41
viewsImproving python-generated table visuals with Django and bootstrap
I have a table that I Gero through the python prettytable, it generates a variable that contains a table, I send this variable to the Jango template and it is all disfigured, could I improve her…
-
0
votes1
answer543
viewsConfigure HTML table using python’s Django for structure
I’m making a table through 3 lists generated in the views, but I can’t leave the table configured correction in html, would be 3 columns and 60 lines, but they are not adjusted correctly, follow my…
-
0
votes1
answer60
viewsORA-01461 error when trying to save a CLOB text field generated by a template. What do I do to fix this?
Error trying to save a record in Lotemail class. table: lotemail LOTEMAILID NOT NULL NUMBER(18) LOTEMAILCORPO CLOB Class: class Lotemail(models.Model): lotemailid = models.BigIntegerField(…
-
0
votes1
answer285
viewshow to insert object_list inside the select of the form in the Django 2.1 template
how can I insert a list of my database into the select form? html template. <div class="form-group"> <label for="{{ form.id_departamento }}">Nome departamento</label> <select…
-
0
votes0
answers69
views -
0
votes1
answer101
viewsCorrectly set URLS in Django
I need to make two pages login and Challenge, where urls can be domain/login and domain/challenge or domain/login/challenge Only the way I’m doing is giving 404 Files from the APP: py views. from…
-
0
votes1
answer183
viewsDefault values in the model - Django
I am studying Jango and trying to set a standard value for a field when makemigrations is executed, would inform that such field would receive a default value like 0 models.IntegerField(default=0)…
-
0
votes1
answer203
viewsTake database data by session with Django
Start my session request.session['username'] = 'usuario' request.session['password'] = 'senha' Here is the following, if there is a session username, password and there is no session Challenge, i…
-
0
votes1
answer705
viewsImport: cannot import name 'Usuario' from 'usuarios.models
I have these models where the condo can have multiple apartments and an apartment can have multiple owners, each condo has a syndicate, a sub-index and a manager. I am adding sindico, subsindico and…
djangoasked 5 years, 4 months ago Juliana Marques 337 -
0
votes1
answer105
viewsI’m having trouble showing my Manytomany field models on the Django template
I wonder how I can show my Manytomany field on my table, follow the code below. My Model: class Instrutor(models.Model): id = models.AutoField(primary_key=True) registro_instrutor =…
-
0
votes1
answer26
viewsAttributeerror at /posts/add/ 'Postform' Object has no attribute 'cleaned_data'
I have a Postform class with an is_valid method that validates the form fields, but it is not recognizing the cleaned_data attribute, whenever I try to add a new post this happens: AttributeError at…
djangoasked 5 years, 4 months ago Juliana Marques 337 -
0
votes2
answers295
viewsForeignkey using User in other models
I’m developing a quotation site for language study purposes. I have customized the User models and it includes other attributes such as address and city for example. The problem now is to write the…