Search⌘ K
AI Features

Database View and Proxy Model

Explore how to display data from database views by declaring unmanaged models in Django. Understand creating proxy models to manage a model twice in the admin and customize its display and search options.

Displaying a database view

Sometimes you want to display data which comes from a database view and not from a Django model. It is really easy to do that. You just need to declare the model corresponding to the view in your models.py file but with the specific keyword managed=False in the class Meta and tell Django the database table name:

class QuestionSummary(models.Model):
	month = models.DateField()
	nbQuestionsByMonth =
...