Model manager attributes

56 views
Skip to first unread message

Naveen Yadav

unread,
Oct 14, 2017, 11:13:24 AM10/14/17
to Django developers (Contributions to Django itself)
I have few questions about manager class

creation_counter is used to keep track of Manager's instance being created, what is the motivation behind this ?
and
what is the purpose of check() which returns empty list ?


Thanks.




Tomer Chachamu

unread,
Oct 14, 2017, 11:49:52 AM10/14/17
to Django developers (Contributions to Django itself)
check() is called here: https://github.com/django/django/blob/d7b9aaa366dd54ecc3142c588162e3adc7c2f7ac/django/db/models/base.py#L1265
It can be used to implement configuration checks. https://docs.djangoproject.com/en/1.11/topics/checks/#field-model-manager-and-database-checks

creation_counter appears to be used to make sure the managers are always initialised in the same order as they were defined in the model (for models that use multiple managers).
Reply all
Reply to author
Forward
0 new messages