#34251: Paginator should warn if ordering is not deterministic
------------------------------------+--------------------------------------
     Reporter:  Alexandr Tatarinov  |                    Owner:  nobody
         Type:  New feature         |                   Status:  closed
    Component:  Core (Other)        |                  Version:  4.1
     Severity:  Normal              |               Resolution:  needsinfo
     Keywords:                      |             Triage Stage:  Unreviewed
    Has patch:  0                   |      Needs documentation:  0
  Needs tests:  0                   |  Patch needs improvement:  0
Easy pickings:  0                   |                    UI/UX:  0
------------------------------------+--------------------------------------
Changes (by Carlton Gibson):

 * status:  new => closed
 * resolution:   => needsinfo


Comment:

 Hi Alexandr.

 > Would like to hear your thoughts.

 > The outstanding question is, how to realistically deal with this
 situation when ordering is provided by the end-user? It's typical to have
 i.e. "sort by price asc/desc" option in the UI or API, which will result
 in a warning since the price is not a unique column. Pushing
 responsibility to add "pk" to each sorting option to the front end does
 not seem like a reasonable way to me.

 My initial thought is that you just wouldn't do this. You'd let the user
 pick "sort by price asc/desc" sure, but then before passing that to the
 ORM you'd add the needed "pk" to the ordering to give you the
 deterministic ordering you need. (In general you're never going to pass
 any user input to the ORM before passing it through a
 sanitation/transformation layer, such as a form.)

 Maybe this is a good idea. I don't know — what would it look like? (It's
 really hard to say without a concrete suggestion in hand.) I think the way
 forward would be to show what the edit to the paginator would look like —
 is it just going to warn or do you think automatically enforcing the
 correct ordering is wanted? With that in hand it's easier to say if it's
 going be too complex or not to be worth the effort.

 The flip side of complexity is how useful this might be. That it was fixed
 for the admin is positive, see #17198 — ''...we can't expect users to
 understand partial ordering...''. I still think a proof-of-concept would
 be helpful, but a discussion on the DevelopersMailingList or the Django
 Forum would reach a bigger audience, to get more voices.

 Make sense?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34251#comment:1>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070185a081989d-998561e3-2692-49e3-b2ed-ac36fcbfdd24-000000%40eu-central-1.amazonses.com.

Reply via email to