#13192: ModelAdmin.queryset() internal documentation -------------------------------------------------+-------------------------- Reporter: Keryn Knight <[email protected]> | Owner: nobody Status: new | Milestone: 1.3 Component: django.contrib.admin | Version: 1.1 Keywords: queryset modeladmin documentation | Stage: Unreviewed Has_patch: 0 | -------------------------------------------------+-------------------------- Part of this may tie into #10712 which is an attempt to provide userland documentation for ModelAdmin methods. Currently, the internal docstring for ModelAdmin.queryset() reads as follows: {{{ """ Returns a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view. """ }}} The implication seems to be that its only called by the changelist. In certain circumstances, it may be useful to override what's displayed in the changelist - this is part of what #10712 attempts to address. Modifying the queryset method (and by extension ChangeList) actually affects the queryset used by the entire modeladmin, which means one cannot navigate to an edit object not in the modified queryset.
I concede that this is currently by design, and is in most cases the expected (and desired) behaviour. Certain circumstances may facilitate changing this default, which currently involves generating two ChangeList objects in the changelist_view() method and using context precedence to get rid of the original. As I see it, there are three options. The simplest is obviously to ignore this as by design and wontfix. Another is to expand the docstring to explain in more detail its overall role in the modeladmin (which may mean changing #10712 further). The hardest (and best, in my opinion) option is, I think, mostly put forward by #10761 - have multiple methods we can easily modify in userland, defaulting back to queryset() if they're not provided, perhaps. -- Ticket URL: <http://code.djangoproject.com/ticket/13192> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.
