mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify models' default and base managers.
This deprecates use_for_related_fields. Old API: class CustomManager(models.Model): use_for_related_fields = True class Model(models.Model): custom_manager = CustomManager() New API: class Model(models.Model): custom_manager = CustomManager() class Meta: base_manager_name = 'custom_manager' Refs #20932, #25897. Thanks Carl Meyer for the guidance throughout this work. Thanks Tim Graham for writing the docs.
This commit is contained in:
parent
3a47d42fa3
commit
ed0ff913c6
18 changed files with 815 additions and 226 deletions
|
@ -35,6 +35,16 @@ Available ``Meta`` options
|
|||
or ``app_label.model_name`` you can use ``model._meta.label``
|
||||
or ``model._meta.label_lower`` respectively.
|
||||
|
||||
``base_manager_name``
|
||||
---------------------
|
||||
|
||||
.. attribute:: Options.base_manager_name
|
||||
|
||||
.. versionadded:: 1.10
|
||||
|
||||
The name of the manager to use for the model's
|
||||
:attr:`~django.db.models.Model._base_manager`.
|
||||
|
||||
``db_table``
|
||||
------------
|
||||
|
||||
|
@ -95,6 +105,16 @@ Django quotes column and table names behind the scenes.
|
|||
setting, if set. If the backend doesn't support tablespaces, this option is
|
||||
ignored.
|
||||
|
||||
``default_manager_name``
|
||||
------------------------
|
||||
|
||||
.. attribute:: Options.default_manager_name
|
||||
|
||||
.. versionadded:: 1.10
|
||||
|
||||
The name of the manager to use for the model's
|
||||
:attr:`~django.db.models.Model._default_manager`.
|
||||
|
||||
``default_related_name``
|
||||
------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue