...

/

Database View and Proxy Model

Database View and Proxy Model

Learn how to display a database view and create proxy models.

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