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
-
2
votes1
answer5877
viewsDjango - Mascara CPF, DDD and phone number
I need to put a mask on the number, ID number and phone number. I am a beginner in Python and Django and would like to know how I can present this mask at the time of typing: For CPF:…
-
2
votes1
answer3528
viewsTypeerror: expected string or bytes-like Object Datefield
I am having a very boring problem in Django to work with date. I am sending from my angular a date I select in a input data. In my view, i turn the date to that format: 2017-10-13 When I try to…
-
2
votes2
answers528
viewsHow to call class method in another app?
I want to create a file called config.py and put some settings inside a dictionary for whenever you need to invoke these parameters. But how I call this parameter in Python? For example, I will…
-
2
votes0
answers238
viewsDjango-Rest-framework update user from another user
I need to change users from another user. But when I call serializer.save() it is not saved in the database and does not present error. My user model: class User(AbstractBaseUser, PermissionsMixin):…
-
2
votes2
answers225
viewsMake a Relationship Many for Many
I am trying to put in a view the amount of students enrolled in a course using the following Models below. NOTE: I cannot change the columns of the Models, since the database already exists and I am…
-
2
votes1
answer906
viewsCustomize Django Admin
I have two classes, one is Division and the other is Group. In the group I have FK for division. I want to register a Storage in the Django Admin and in the Group select I want the group and…
-
2
votes1
answer721
viewsHow to call a class attribute in another Django class
I’m trying to create classes that will relate in a certain way. The idea is to be a game in which the player will have some options of choice and then your score is based on the score of your…
-
2
votes1
answer130
viewsDJANGO > Render one FOR inside another
I have a situation that is as follows: I need to make a Tablea in html where I have to show the totalizers and a line and the values that make up this totalizer, as a small example below Revenue =…
-
2
votes1
answer125
viewsDjango View class keeps values
A curiosity that has accompanied me for a long time in Django and I never managed to heal: Next. Let’s say I have something like: from django.shortcuts import render from django.views import View…
-
2
votes2
answers2510
viewsDjango - select options
I’m trying to put the names of the coordinators in the options of a select looking for the database, I already searched and it seems that there is another way to use select on Django, but it was not…
-
2
votes1
answer250
viewsError deploy Heroku app Django
After deploying to Heroku, I opened the link to my application (https://silima.herokuapp.com/), and it presented the following error: ProgrammingError at / relation "Produto" does not exist LINE 1:…
-
2
votes0
answers54
viewsError trying to disconnect using social-auth-app-Django
Good afternoon, everyone, I am building an application in Django, where it is necessary for the user to authenticate through his Microsoft account, for this, I am using the library…
-
2
votes1
answer1286
viewsDjango: how to use Forms.Validationerror and display messages in the template
I would like to inform a message to the user (in the html template) when identifying an existing email on the registration page. In Forms.py I use the function clean_email to check if there is an…
-
2
votes0
answers106
viewsElements/Images Problems in Selenium Django
I’m having some element problem not load correctly on the page of ChromeDriver using Selenium in my Django app. I shook Django’s test tool because in my scenario, I need the entire base loaded. And…
-
2
votes0
answers136
viewsDjango admin using the request attributes
I am developing an application in Django and I used the request data on form to validate some fields. For example, if the user is changing the form for the "Administrator" group, when changing the…
-
2
votes1
answer355
viewsClick the Save button and change boolean Django 2.0
Gentlemen, I’m studying Django 2.0, and I’m having a problem, by clicking save I want to change the boolean database of False for True, and I have no idea how to do that. If anyone can help me?…
-
2
votes1
answer700
viewsModel field processing before writing to the database (Python + Django)
I am trying to perform a password encryption using Python 3.7 and Django 2.1. Looking at the documentation of Python, Django and some answers here in Stackoverflow, I arrived at the code as follows,…
-
2
votes1
answer63
viewsRemove tags generated at the end of a string from a Text Editor
I am using a text editor and like others I have used, it always generates some useless tags that I would like to remove. I can remove the last, but sometimes it generates more than once. My code:…
-
2
votes1
answer68
viewsSearching for a field contained in several models
I have a manager in my project, which is to make TAGS, and on the front of my system the user will search a tag, and it will return everything related to that tag. Follow the models.py: from…
-
2
votes2
answers763
viewsAccess related table columns through ORM DJANGO
How to access the object user and its attributes after a join? This is my consultation Idea.objects.select_related("user").values("author_id").annotate( qtd=Count('author_id')) Example of a result:…
-
2
votes0
answers125
viewsHow to create a view in a Django project with Python? I’m having errors
I’m a beginner in Django. I’m continuing a ready-made project in Django. I’m looking to add a schedule to the project using Full Calendar. For this I already developed the template with the html…
-
2
votes1
answer448
viewsPass variable javascript to Django Form
I have a Django form with this "Linked Exam" field that works as follows: The user clicks on Select Exam, goes to another window in which selects an existing exam, and with it returns to the…
-
2
votes1
answer286
viewsHow to fire an automatic email through Django when you receive a new value in the database?
Hello, my system is monitoring a server services, when a service fails I get a new value in the database with status "8" which means error, I would like to send an email to some user stating this…
-
2
votes0
answers250
viewsPick values between two dates and display in the Django template
I have two models, flow and report, in the stream there is a date field, and in the report there are two fields, start date and end date, I want to make the report show the records in the flow…
-
2
votes2
answers739
viewsreturn python function variable
I have a function that returns several values, and I wanted to pass two of them out of the function, but when I try it returns that the variable outside the function has not been declared. To…
-
2
votes1
answer44
viewsDjango model mapping problem
The relationship between the classes in the Models.py file does not work because of the order of the classes (I think it has more to do with the interpreter) follows the problem: class…
-
2
votes1
answer135
viewsHow does Django’s standard connection mechanism work?
I am maintaining a system that uses standard connection, via "DATABASES = {", with Oracle 11g. So: DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.oracle', 'USER': 'USUARIO',…
-
2
votes3
answers208
viewsHow to configure Settings.py to use Django-tenant-schema?
I need to configure my Django to run llb django-tenant-schema My project does not create schemas and soon I cannot synchronize my bank with the project. I’m having trouble understanding how you are…
-
2
votes1
answer2507
viewsToo Many values to unpack (expected 2) no Django
I have this piece of code in Django, the intention is to insert, if there is already the ds_user_id then it updates the user with this ds_user_id instead of creating a new ds_user_id =…
-
2
votes2
answers74
viewsProblem when displaying routes in Root Api
I have a file urls.py in the project with my API routes, I am importing the routes and concatenating into a variable called api_urls, to then include the variable with the routes, but when doing…
-
2
votes1
answer681
viewsHow to save a <select> option in the database? DJANGO
Hello, I’m a beginner in Django and I’m making simple applications just to train the use of Database with the use of forms. Inside my form, I have a part where the person will select a certain…
-
2
votes1
answer380
viewsDjango does not validate changed fields in the client by JS
My project has a form that one of the fields is object list (Courses), but these objects are being passed from another list (Courses of the area) through Javascript, only that the values allocated…
-
2
votes1
answer83
viewsHow can I run a function when user registers Django
I am developing a server using Django and wanted when a user registers to run a function that would create a directory with the user name. The folder with the new user name will be stored in…
-
2
votes1
answer98
viewsTO BE executed asynchronously
Is there any way to execute a FOR asynchronously? What happens is this, my program recovers a large number of data from the database, processes it and returns the result to the user. I’m doing it…
-
2
votes1
answer138
viewsMultiply column with Manytomany Count() from the same Model Django
I have a model called Notificacoes and it has the following structure: Notificacoes(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL) users_interacting =…
-
2
votes1
answer737
viewsDjango: How to set MEDIA_URL, MEDIA_ROOT and upload_to correctly?
I’m having a hard time with my Django project. I have a template to upload the images, where I have a field to add a description for each one, and another to search all the images with this…
-
2
votes1
answer70
viewsWorking with static methods/variables
Expensive, When calling a python class, the variables of that class will always be restarted? What happens is this: I’m working with the parallelization of my code. I receive the data returned from…
-
2
votes1
answer1301
views'Model' Object is not iterable
As soon as I click on a button that calls my view to edit the Row of the table in question shows me the error: 'Meumodel' Object is not iterable. I’m using Django 2.1.15 Python 3.8.1 SQL server…
-
2
votes1
answer107
viewsHow to generate pdf from a Django page with graphics, images and text (result of an Assessment)
I am developing an application with Django and need to display the result of an Assessment (test) that will have text, images and graphics. Initially I did this part using Chart.js based on this…
-
2
votes1
answer67
viewsHow to select multiple items from a dropdown, choose these items with a button, and then reload the screen?
In this html code of a Django project how to add a feature that the user will choose how many services they want and click on the button when finished choosing. In this application I can only choose…
-
2
votes1
answer518
viewsAttributeerror - 'User' Object has no attribute 'project' - Django
I am new in Django and have a question. I made a system that saves the contents of the respective logged in user. Thus, each user will have their own content when viewing (multi-tenant system).…
-
2
votes2
answers164
viewsDjango does not create tables
Greetings to you all. I’m having trouble creating the tables for my apps by Django. I run the PYTHON MANAGE.PY MAKEMIGRATIONS command and it responds: NO CHANGES DETECTED. Then I run the PYTHON…
-
2
votes3
answers37
viewsSend template data to database
I am facing a problem that in Django, in which my form cannot be validated, therefore, does not enter the data in the database. I want the user to have the option of adding a teacher. The structure…
-
1
votes1
answer467
viewsHow to submit a post using Django Rest Framework and Angular.js
How do I submit a post on Angular? I ran a test here and requires you to report to PK: index.controller('EditController', function($scope, $http) { $scope.save = function() { var in_data = { name:…
-
1
votes1
answer1060
viewsList objects from a dictionary in Django - Creating Templates
I’m trying to learn something about Django, and a doubt has arisen. I have a dictionary with several keys and valuables. The idea is, for each key, to display a list of values with checkboxes that…
-
1
votes1
answer1397
viewsHow do I use Template Inheritance to inherit Style Sheets (css) in my Django project?
I have a base.html template and another library.html template that is inheriting base! I managed to inherit most of the base.html, but when I try to add another link tag in the Style block Django…
-
1
votes1
answer66
viewsHow to assign a class to a field type in Django?
I’m trying to figure out which field is a DateField and thereby assign a class='date'. How do I know the guy from the field? The following code does not work but presents the logic: class…
-
1
votes1
answer1069
viewsAutomatic filling of fields
I’m developing a applying with Django (1.6.2) and Python 2.7 for learning, the application performs registration, searches and edits in DB, in one of the registrations I perform I would like to…
-
1
votes1
answer2125
viewsTable editing, Datefield field
In one of the Insert’s of my application, I have a field Datefield, At first there is no error when saving the dates in the Database (Sqlite3), i inform a date in format DD/MM/AAAA, and she is saved…
-
1
votes1
answer113
viewsHow to serve a static page from.py urls?
I have a website in Django where I want to serve the favicon.ico - which being a static file, is in STATIC_URL/caminho/pro/favicon.ico. It is possible to do this directly from urls.py? (i.e. without…