Top "Django" questions

Django is an open-source server-side web application framework written in Python.

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. …

python django django-models
Django Template Variables and Javascript

When I render a page using the Django template renderer, I can pass in a dictionary variable containing various values …

javascript python django google-app-engine django-templates
Django MEDIA_URL and MEDIA_ROOT

I'm trying to upload an image via the Django admin and then view that image either in a page on …

django media
What is `related_name` used for in Django?

What is the related_name argument useful for on ManyToManyField and ForeignKey fields? For example, given the following code, what …

python django many-to-many foreign-key-relationship
Extending the User model with custom fields in Django

What's the best way to extend the User model (bundled with Django's authentication app) with custom fields? I would also …

django django-models django-authentication django-users
Find object in list that has attribute equal to some value (that meets any condition)

I've got list of objects. I want to find one (first or whatever) object in this list that has attribute (…

python django list
How to execute a Python script from the Django shell?

I need to execute a Python script from the Django shell. I tried: ./manage.py shell << my_script.…

python django django-shell
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 …

django django-migrations
DatabaseError: current transaction is aborted, commands ignored until end of transaction block?

I got a lot of errors with the message : "DatabaseError: current transaction is aborted, commands ignored until end of transaction …

python django postgresql psycopg2
How to convert a Django QuerySet to a list

I have the following: answers = Answer.objects.filter(id__in=[answer.id for answer in answer_set.answers.all()]) then …

django