November 2015
Beginner to intermediate
840 pages
26h 30m
English
While the ability to write methods to add behavior to a model is quite useful, the ability to affect existing behavior is perhaps even more important. Django allows developers control of how the system interacts with models by providing configurable options, customizable in a nested class titled Meta.
For example, we can tell Django that we want to order our Tag model alphabetically by the model’s name field by adding the code in Example 3.19 to /organizer/models.py.
Example 3.19: Project Code
organizer/models.py in 3c8067a1b8
8 class Tag(models.Model): . ... 16 class Meta: 17 ordering = ['name']
Django will look for the Meta class ...
Read now
Unlock full access