Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#11853 closed (invalid)

Django admin uses default Manager

Reported by: Alasdair <alasdair@…> 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)

comment:1 by Jacob, 15 years ago

Resolution: invalid
Status: newclosed

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 the queryset argument to ModelAdmin to change what queryset the admin uses.

in reply to:  1 comment:2 by Karen Tracey, 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 the queryset argument to ModelAdmin 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.

Note: See TracTickets for help on using tickets.
Back to Top