Django

Code

Changeset 7302

Show
Ignore:
Timestamp:
03/18/08 14:55:21 (6 months ago)
Author:
ubernostrum
Message:

Fixed #6541: Corrected documentation of how the admin chooses a default manager. Refs #6538.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/model-api.txt

    r7294 r7302  
    17891789and ``Person.people.all()``, yielding predictable results. 
    17901790 
    1791 If you use custom ``Manager`` objects, take note that the first ``Manager`` 
    1792 Django encounters (in order by which they're defined in the model) has a 
    1793 special status. Django interprets the first ``Manager`` defined in a class as 
    1794 the "default" ``Manager``. Certain operations -- such as Django's admin site -- 
    1795 use the default ``Manager`` to obtain lists of objects, so it's generally a 
    1796 good idea for the first ``Manager`` to be relatively unfiltered. In the last 
    1797 example, the ``people`` ``Manager`` is defined first -- so it's the default 
    1798 ``Manager``. 
     1791If you use custom ``Manager`` objects, take note that the first 
     1792``Manager`` Django encounters (in the order in which they're defined 
     1793in the model) has a special status. Django interprets this first 
     1794``Manager`` defined in a class as the "default" ``Manager``, and 
     1795several parts of Django (though not the admin application) will use 
     1796that ``Manager`` exclusively for that model. As a result, it's often a 
     1797good idea to be careful in your choice of default manager, in order to 
     1798avoid a situation where overriding of ``get_query_set()`` results in 
     1799an inability to retrieve objects you'd like to work with. 
    17991800 
    18001801Model methods