Model class reference
This document covers features of the Model
class.For more information about models, see the complete list of Modelreference guides.
Attributes
objects
Model.
objects
- Each non-abstract
Model
class must have aManager
instance added to it.Django ensures that in your model class you have at least adefaultManager
specified. If you don't add your ownManager
,Django will add an attributeobjects
containing defaultManager
instance. If you add your ownManager
instance attribute, the default one doesnot appear. Consider the following example:
- from django.db import models
- class Person(models.Model):
- # Add manager with another name
- people = models.Manager()
For more details on model managers see Managersand Retrieving objects.