Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [django]

Django is an open-source server-side web application framework written in Python. It is designed to reduce the effort required to create complex data-driven websites and web applications, focusing on less code, no redundancy and being more explicit than implicit.

django
1393 votes
30 answers
557k views

What is the difference between null=True and blank=True in Django?

When we add a model field in Django we generally write: models.CharField(max_length=100, null=True, blank=True) The same is done with ForeignKey, DecimalField etc. What is the basic difference ...
user993563's user avatar
  • 19.2k
1222 votes
29 answers
210k views

Has Django served an excess of 100k daily visits? [closed]

I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I ...
Roee Adler's user avatar
  • 33.9k
995 votes
10 answers
729k views

Is there a list of Pytz Timezones?

I would like to know what are all the possible values for the timezone argument in the Python library pytz. How to do it?
ipegasus's user avatar
  • 15.2k
986 votes
17 answers
723k views

How do I do a not equal in Django queryset filtering?

In Django model QuerySets, I see that there is a __gt and __lt for comparative values, but is there a __ne or != (not equals)? I want to filter out using a not equals. For example, for Model: bool ...
MikeN's user avatar
  • 45.9k
838 votes
9 answers
927k views

How can I temporarily disable a foreign key constraint in MySQL?

Is it possible to temporarily disable constraints in MySQL? I have two Django models, each with a foreign key to the other one. Deleting instances of a model returns an error because of the foreign ...
jul's user avatar
  • 37.2k
834 votes
16 answers
479k views

How to combine multiple QuerySets in Django?

I'm trying to build the search for a Django site I am building, and in that search, I am searching across three different models. And to get pagination on the search result list, I would like to use a ...
espenhogbakk's user avatar
  • 11.7k
804 votes
15 answers
528k views

How to revert the last migration?

I've made a migration that added a new table and want to revert it and delete the migration, without creating a new migration. How do I do it? Is there a command to revert last migration and then I ...
Ronen Ness's user avatar
  • 10.5k
788 votes
10 answers
1.3m views

Where does pip install its packages?

I activated a virtualenv which has pip installed. I did pip3 install Django==1.8 and Django successfully downloaded. Now, I want to open up the Django folder. Where is the folder located? Normally it ...
SilentDev's user avatar
  • 22.3k
767 votes
14 answers
263k views

What is a "slug" in Django?

When I read Django code I often see in models what is called a "slug". I am not quite sure what this is, but I do know it has something to do with URLs. How and when is this slug-thing ...
Jonas's user avatar
  • 19.6k
744 votes
10 answers
442k views

How to upload a file in Django? [closed]

What is the minimal example code needed for a "hello world" app using Django 1.3, that enables the user to upload a file?
qliq's user avatar
  • 11.8k
722 votes
11 answers
554k views

What does on_delete do on Django models?

I'm quite familiar with Django, but I recently noticed there exists an on_delete=models.CASCADE option with the models. I have searched for the documentation for the same, but I couldn't find anything ...
All Іѕ Vаиітy's user avatar
719 votes
34 answers
889k views

How to check Django version

I have to use Python and Django for our application. So, I have two versions of Python, 2.6 and 2.7. Now I have installed Django. I could run the sample application for testing Django successfully. ...
maheshgupta024's user avatar
686 votes
6 answers
452k views

What is related_name used for?

What is the related_name argument useful for on ManyToManyField and ForeignKey fields? For example, given the following code, what is the effect of related_name='maps'? class Map(db.Model): ...
zjm1126's user avatar
  • 65.8k
659 votes
11 answers
1.3m views

How can I upgrade specific packages using pip and a requirements file?

I'm using pip with a requirements file, in a virtualenv, for my Django projects. I'm trying to upgrade some packages, notably Django itself, and I'm getting an error about source code conflicts: ...
gcaprio's user avatar
  • 6,647
657 votes
27 answers
337k views

How to debug in Django, the good way? [closed]

So, I started learning to code in Python and later Django. The first times it was hard looking at tracebacks and actually figure out what I did wrong and where the syntax error was. Some time has ...
googletorp's user avatar
  • 33.2k

15 30 50 per page
1
2 3 4 5
20863