#11853 closed (invalid)
Django admin uses default Manager
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | 1.1 |
Severity: | Keywords: | admin Managers | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've defined a custom manager for my Entry model:
Class Entry(models.Model): [snip...] live = LiveEntryManager() objects = models.Manager()
The documentation says:
"Django interprets this first Manager defined in a class as the "default" Manager, and several parts of Django (though not the admin application) will use that Manager exclusively for that model."
which I understand to mean that the admin will continue to use models.Manager. However the admin appears to use the LiveEntryManager. It is not clear how I can get the admin application to use models.Manager, and display all Entries.
Apologies if I've misunderstood the documentation.
Change History (2)
follow-up: 2 comment:1 by , 15 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 15 years ago
Replying to jacob:
The docs are correct;
LiveEntryManager
is the "first Manager defined in [the] class", and so the admin uses it to access entries for that model. Look into thequeryset
argument toModelAdmin
to change what queryset the admin uses.
Except the parenthetical comment in the docs state the admin will NOT use the default manager exclusively. If I didn't know about setting queryset for a ModelAdmin (which doesn't seem to be documented?) I would have interpreted that parenthetical aside the same way the reporter did. That sentence is very confusing.
The docs are correct;
LiveEntryManager
is the "first Manager defined in [the] class", and so the admin uses it to access entries for that model. Look into thequeryset
argument toModelAdmin
to change what queryset the admin uses.