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
answer132
viewsPython multidimensional array
I have a series of data that I would like to organize by title, example; movies = [ 'movie': [ 'legenda' [ 'dub', 'leg', 'nac' ], 'time': [ 1, 2, 3, 4, 5 ] ] .... ] I tried with dict() with list()…
-
2
votes1
answer82
viewsRemove Session Data Dictionary with ajax in Django
I have an array with a data dictionary in my Session and would like to remove according to the row the user is going to click on a table where these values are displayed. My view: def…
-
2
votes1
answer296
viewsError in month language Django
Good morning guys, Next, I have a very troublesome problem. When I try to use the date that was stored in the database, it comes with the month in English. py Settings.: LANGUAGE_CODE = 'pt-br'…
-
2
votes1
answer161
viewsRefactoring Python code
How do I improve this code? import random import string import requests from django.core.management.base import BaseCommand, CommandError from django.core.exceptions import ValidationError from…
-
2
votes0
answers262
viewsHow to create a custom model field by inheriting Foreignkey in Django?
I’m looking to build a custom model field that behaves like Foreignkey, only with a few additional details. This custom field will automatically register a document, passing as reference the model…
-
2
votes1
answer851
viewsTotal and subtotal in Django template using lists
How do I calculate the subtotal and total per store (store) in the view to play the results in the template? In this case I’m using lists. def quotation_list(request): stores =…
-
2
votes1
answer86
viewsSession in Forms
What I did I have a view that calls a template with a form. In a given case, I need to save some data in the session scope and send it to another url - which will call another view and another…
-
2
votes0
answers79
viewsLeaving the entire column highlighted (Django + template)
I’m trying to leave the whole column colored, but only the last line is getting. I’ve tried every possible logic, but I’m not getting it right. This post is a continuation of Total and subtotal in…
-
2
votes1
answer57
viewsInclude in <head> Djanto Templates
I have the following files: base.html: <!-- base.html -- --> <html> <head> <title>Title</title> {% include "head.html" %} </head> <body> Body </body>…
-
2
votes1
answer439
viewsDjango Urlconfs name parameter
In Urlconf below: urlpatterns = [ url(r'^$', views.index, name='index'), ] What is the function of the parameter name? It is possible to explain with a practical example?…
-
2
votes1
answer222
viewsDeploy to Heroku PYTHON/DJANGO application giving error
I made a change to the default auth of Django and my project is working properly but when I give git push Heroku master and then use the command Heroku run python Manage.py migrate to create my…
-
2
votes1
answer146
viewsForeign Key Rendering in Django
I am using Createview on Jango and rendering my components with Tweak widget I would like to know if you have any way to exchange this first combo option rendered form in the template {%…
-
2
votes1
answer89
viewsDjango collectstatic AWS S3
I have a question regarding collectstatic. I’m using Amazon Free Tier and I realized that I exceeded the use limit of S3 PUT because I did several collectstatic. I was one day developing in Mazon’s…
-
2
votes1
answer78
viewsVersion control of dependencies
Use python, Django on a server with CloudFoundry installed. There, I can keep my requirements.txt with all the dependencies of my application and, for security, I always keep the exact name of the…
-
2
votes2
answers1344
viewsHow to Create an Auto Increment in Django that is not pk
I’m creating a memo system with Django and it’s working fine, but I need to put in a self-improvement field that’s not pk. I have this field in my models. Memo = models.IntegerField() I need it…
-
2
votes2
answers67
viewsHow to perform an arithmetic operation by changing numerous database fields efficiently?
There is a table with 200 records and one of the fields is responsible for indicating the order that these data are shown (0, 1, 2, 3, 4, 5, ...). I need to rearrange this data, take the record from…
-
2
votes1
answer97
viewsDjango Debug Toolbar
good evening!! Can anyone help me with this error, I am trying to use debug_toolbar: Traceback (most recent call last): File "./manage.py", line 10, in <module>…
djangoasked 8 years, 6 months ago Sara Fernandes 317 -
2
votes1
answer1063
viewsForm for Foreignkey Relationship
is the following created 3 models, one is the Person, another is the aggressor and the other is Life . Being that Aggressor inherits from person (I have already done the inheritance). And the class…
djangoasked 8 years, 6 months ago Sara Fernandes 317 -
2
votes2
answers151
viewsError in Django Module
Whenever I try to run, I’m getting the following error described below. I’ve already searched a solution, but I can’t make it work. Exception Type: Valueerror Exception Value: Models in the…
-
2
votes1
answer86
viewsConvert to list a string from a list that contains Base64?
I receive through a requisition json one request.POST that comes as a list of string Base64. I can convert to string with str(request.POST['imagem']) what results something like this:…
-
2
votes2
answers535
viewsDjango Custom Template Tags
Good afternoon, recently I have a problem in the Django framework, I have a problem in my custom template tag, I do the method in a.py file call it in the templates and does not display the result I…
-
2
votes1
answer756
viewsHow to open pdf that is located in a folder in the project in html?
I’m trying to open a pdf file that is located in a folder within the project, but it’s not working. I followed some suggestions and tried that: <a…
-
2
votes1
answer578
viewsDjango Admin: Changing display format of a date field
In the Admin, my application shows the date in full 19 de January de 2017 in changed_listview. How do I show the date in the form DD/MM/AAAA?
djangoasked 7 years ago Pedro de Jesus Barruzi 21 -
2
votes1
answer711
viewsDjango - Unicodedecodeerror: 'ascii' codec can’t Decode byte 0xc3 in position 32: ordinal not in range(128)
Good night, you guys! I am with Ubuntu 16.04, trying to get back to Django, ms when I try to start a project of that error here: raceback (Most recent call last): File…
-
2
votes2
answers186
viewsDjango Rest and Angularjs Cors error
I am using Django Rest and Angularjs 1.x in a project, in case this backend project and frontend are isolated, I am using a server with Gulp to run the Angularjs, but when I try to access the Rest…
-
2
votes1
answer358
viewsHow do I use Firebase as a database in a Django application?
I just created a Django project and would like to use Firebase instead of sqlite as a database. I looked in several places but could not find anywhere how to do the integration. Someone could help…
-
2
votes1
answer664
viewsWhat is a migrate?
I am a beginner in the world of Jango and one of the first things I find in tutorials is the term migrate I’d like to know what that refers to, how to use it and what it’s for.
-
2
votes2
answers174
viewsHow to write the date and time of an error in the Django log?
I started a project on Django 1.4, and every mistake I picked up via try..except I printed on sys.stderr - making it fall into the same Apache log file (error.log). It worked, but only for the…
-
2
votes2
answers326
viewsHow to use the Django User part in a model?
I’m blogging and the question arose, has how to use the user system of Django to make a Foreignkey in my Author variable ? from django.db import models class Category(DatastampMixin): name =…
-
2
votes1
answer442
views404 Error Python Django
That’s the mistake I’m having: As you can see in the URLS list the number 8 is equal to the "Current url" given below. My url list: from django.conf.urls import include, url from django.contrib…
-
2
votes1
answer71
viewsOauth v2 in Django 1.4
Friends, I am studying how to implement the Oauth v2 protocol in my application. I’ve done a lot of research here, and I haven’t found anything that could solve my problem. So far I have a database…
-
2
votes2
answers258
viewsHow to save Django objects with quantity validation?
I’m still a beginner in Django and would like to know how I would do to save a certain amount of students in vacancies. Example: vagas = 5, how do I allow them only to be saved 5 students? class…
-
2
votes1
answer60
viewsReturn message from Else
I’m making a very simple example using Django. In my view I have the following : def index(request,idade): string = ''' {% if idoso >= 65 %} Você já é idoso {% else %} Você não é idoso {% endif…
-
2
votes2
answers589
viewsLegacy of templates with Django
I’m having a bit of a problem applying template inheritance with Django. Apparently it’s all right but my html son is not rendered in the template html base. <!doctype html> {% load static %}…
-
2
votes1
answer1157
viewsDjango does not render static files that are in subfolders within /Static/
I am working on a Django project that has static files (css/js/imgs) according to the following structure: File Structure django_project | +apps | +django_project | +media | +static | +admin…
-
2
votes1
answer781
viewsUpload and view PDF’s Django admin
I wanted to ask a question, I am trying to upload a PDF file, on Jango, and I wanted to know if you like I view this pdf, I have the following code: py.models class Edital(models.Model): # ... class…
-
2
votes1
answer377
viewsHow to access data from a dynamic imput of a form with Django?
I am participating in a project in which we are using Django. I created a form with two initial fields and can add more dynamically using javascript. <div class="form-group"> <div…
-
2
votes1
answer1025
viewsOrder form with Python and Django
I’m starting my studies with Python and Django. After creating several simple CRUDS, I tried to create a more complex form using several classes, but was unsuccessful. I want to create a screen for…
-
2
votes2
answers593
viewsWhat is the difference between project ("project") and application ("app") in Django?
I had done some tests as Django framework a while ago, and only now that I tested it again, I noticed that there are two commands, which ended up confusing me: django-admin startproject…
-
2
votes1
answer1306
viewsPython / Django interval of hours
I need to create a schedule of hours: I have the following information in the Django template: Initial time: 08:00 Final time: 18:00 Break in minutes 00:30 I would have been able to implement…
-
2
votes1
answer467
viewsDjango and Oracle database (accessing your views via ORM)
Hello, despite the title self explanatory. I will detail my doubt to follow. I have a pre-existing Oracle database, integrated it with Django by configuring the default connection in Settings and…
-
2
votes1
answer95
viewsError creating admin user Django 1.11
I’ve been trying to create a user for a while admin, but it always returns me the error below. What can is happening? I am using the following settings: Ubuntu Server 14.04.5 LTS, Python 3.4.3,…
djangoasked 7 years, 5 months ago Ezequias Silva 63 -
2
votes1
answer958
viewsHow to catch the current user in the Django model?
Hello, I’m creating a Django application and I have a model with the Newdemand class in which I need that when the user creates a demand, the name of the guy is saved in a field. Here my class:…
-
2
votes1
answer598
viewsDjango request.GET
Is there any simpler way to do that? if "id_parada" in request.GET: id_parada = request.GET["id_parada"] else: id_parada = ''
-
2
votes1
answer1521
viewsFiles deleted by Django Migrations
I’m having a constant problem. As I am working with several branchs in a project, sometimes I go back in an old branch, bring updated branch to the old one so I don’t have to keep creating old bank…
-
2
votes1
answer269
viewshow to use Vue.js interpolation in a Jango template?
Django uses a template syntax tool, called jinja2, which allows interpolation in the html document using double keys. Unfortunately, Vue.js uses interpolation in the same way. <p id="exemplo">…
-
2
votes1
answer1920
viewsRedirect to another page in the Django view
I’m learning Django now and the idea is this: I have a registration form only with the email, when this email is filled and the user click send, I need the view to direct to the other page where the…
-
2
votes1
answer154
viewsSort queryset Django by priority
I am creating a search system on my platform. I do a search for the title of the content, description and tags within it. Follow the code: questions = Question.objects.filter(reduce(lambda x, y: x |…
-
2
votes1
answer334
viewsError in html Django?
Good morning guys, I’m having a little problem referencing my variable in the html of Django. I’m a beginner in the web part, I’m trying to create a site for a project, so during the html…
-
2
votes1
answer113
viewsHow to link a different stylesheet to the Django base template stylesheet
Let’s say we have the following template as the basis of a Django project (which will be called here html base.): {% load staticfiles %} <html lan="pt-br"> <head> <link…