#29688: ModelAdmin: Add attribute to override manager used by
ModelAdmin.get_queryset()
-------------------------------+--------------------------------------
     Reporter:  Jon Dufresne   |                    Owner:  nobody
         Type:  New feature    |                   Status:  new
    Component:  contrib.admin  |                  Version:  master
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  1              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by Carlton Gibson):

 Hey Jon.

 Yes. I'm quite sure you do understand the trade-offs. That doesn't
 convince me that we should be encouraging (or enabling even) users down
 this road.

 Forcing you to override `get_queryset()`, duplicated logic isn't much:

 {{{
     def get_queryset(self, request):
         qs = self.model._base_manager.get_queryset()
         ordering = self.get_ordering(request)
         if ordering:
             qs = qs.order_by(*ordering)
         return qs
 }}}

 Half-a-dozen lines seems better to me that adding an extra option to the
 ModelAdmin API. (Which is already massive.)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29688#comment:4>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.ab2fbf37ff260e87a89915b4c2574093%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to