Model API documentation section 'Modifying initial Manager QuerySets' misleads about Admin behaviour
|Reported by:||Alex Dedul||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you use custom Manager objects, take note that the first Manager Django encounters (in order by which they're defined in the model) has a special status. Django interprets the first Manager defined in a class as the "default" Manager. Certain operations -- such as Django's admin site -- use the default Manager to obtain lists of objects, so it's generally a good idea for the first Manager to be relatively unfiltered.
But if you have your custom manager in a model even called 'objects' admin anyway will display all records from model regardless specified custom manager. The only way i found to tell admin to use custom manager is to use 'manager' attribute in inner Admin class in a model. So i guess reference to admin should be removed from here for now and 'manager' attribute of inner Admin class documented instead.
Change History (6)
comment:1 Changed 9 years ago by Michael Radziej <mir@…>
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:5 Changed 9 years ago by Michael Radziej <mir@…>
- Component changed from Documentation to Admin interface
- Owner changed from jacob to adrian
- Triage Stage changed from Unreviewed to Accepted