#29700: Provide an "autocomplete_ordering" value in ModelAdmin, to decouple
autocomplete ordering from admin ordering
--------------------------------+--------------------------------------
     Reporter:  David W. Lloyd  |                    Owner:  nobody
         Type:  New feature     |                   Status:  new
    Component:  contrib.admin   |                  Version:  2.1
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------

Comment (by David W. Lloyd):

 Replying to [comment:2 Johannes Hoppe]:
 > Replying to [comment:1 Carlton Gibson]:
 > >
 > > Thoughts?
 >
 > That is not a bad way, this is how I would go about it myself too.
 Actually this way you can add all sorts of extra functionality.

 I agree, that's a fine way to achieve the functionality, and if
 AutocompleteJsonView gets a bit more documentation, I guess that would be
 the default approach?

 But my thinking is as follows: you can make the same exact argument about
 the *existing* "ordering" field - why have it, when you can do the same
 thing by modifying the queryset?

 I personally believe the answer is: "Because it's a common enough use case
 that having a dedicated field makes it easier, more intuitive, and more
 explicit" - all of which are good things, and I think they apply to the
 autocomplete sorting the same as they do the ModelAdmin sorting.

 Yes, that comes at the cost of adding another field to the API, but that's
 going to be the case with anything you want to make more
 explicit/intuitive. If there was an interest in conserving fields, it
 could be a dict? like:

 {{{
 autocomplete_view_options = {'ordering': 'name,
 'other_useful_parameter_to_be_added_in_future': 'maybe?'}
 }}}

 ...either way, while I see how to achieve the functionality in question
 myself and will have no problem whatsoever doing so, I still believe that
 the explicit decoupling would make sense, either via a single
 "autocomplete_ordering" field or a dict of extensible options including,
 initially, ordering.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29700#comment:3>
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.3e834aa2f84cb6681abb6d7064f89eb0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to