Top "Django-database" questions

django-database refers to database backends that Django supports out of the box

Update only specific fields in a models.Model

I have a model class Survey(models.Model): created_by = models.ForeignKey(User) question = models.CharField(max_length=150) active = models.…

django django-models django-views django-database
How can I subtract or add 100 years to a datetime field in the database in Django?

How can I subtract or add 100 years to a datetime field in the database in Django? The date is in …

python django datetime django-database
Django - Rollback save with transaction atomic

I am trying to create a view where I save an object but I'd like to undo that save if …

python django transactions atomicity django-database
Add Indexes (db_index=True)

I'm reading a book about coding style in Django and one thing they discuss is db_index=True. Ever since …

django django-models django-database
How to count the number of rows in a database table in Django

I have database created by Django model, where status and id and username are the fields of the table Messages. …

django django-models django-database
"Returning to that page might cause any action you took to be repeated" - Django

I have a form on my website, that creates an entry in database. So every time when I refresh a …

django django-models django-database
Django - how to specify a database for a model?

Is there a way to specify that a model (or app, even) should only ever use one particular database? I …

django django-models multiple-databases django-database
Simple Subquery with OuterRef

I am trying to make a very simple Subquery that uses OuterRef (not for practical purposes, but just to get …

python mysql django django-queryset django-database
Django multiple and dynamic databases

I've been evaluating django and wondered if the following is possible. I've already looked at the regular multiple database docs …

django django-database
Django makemigrations AttributeError: 'str' object has no attribute '_meta'

I was playing with the django framework and I ran into an issue running the makemigration command. Here is a …

django django-models django-database