#17522: ModelAdmin.ordering validation too strict
-------------------------------------+-------------------------------------
     Reporter:  Sebastian Goll       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  admin, validation,   |             Triage Stage:  Accepted
  ordering, strict                   |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Javier Abadia Miranda):

 Replying to [comment:7 Simon Charette]:
 >
 > I have to say I'm not convinced this needs to be fixed anyhow. Why
 wouldn't the following be acceptable?
 >
 Because the `ordering` tuple purpose is to specify the **default**
 ordering that the user can change afterwards by clicking on column
 headers. If I'm forced to embed the ordering in the `get_queryset()`
 method, then:
 1) I am forced to implement a get_queryset in situations where I don't
 need to do it, because defining additional columns via properties with
 `get_` methods works fine and it's convenient and consistent with
 `list_display`
 2) The user can't change the ordering afterwards, or I need to put logic
 inside `get_queryset()` to include the sorting or not depending on what
 the user does.
 The funny thing is that everything works as expected, if you can work
 around the too strict (in my opinion) validation.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17522#comment:9>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.a65ba8daffd08d45a0eaa163c5f33b41%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to