Fair. I agree it's more flexible, but it does make "the most common case"
of extending the ordering pretty long-winded:

ordering = qs.get_ordering()
ordering.append('new_field')
qs = qs.order_by(*ordering)

On 18 December 2017 at 21:33, Shai Berger <[email protected]> wrote:

> On Fri, 15 Dec 2017 21:01:39 +0000
> Adam Johnson <[email protected]> wrote:
>
> > I would prefer the QuerySet method than documenting parts of Query -
> > QuerySet shouldn't have to make guarantees that its interactions with
> > Query won't change, plus making Query in some way a public API could
> > hamper features. Plus the amount of code is small and contained.
> >
>
> I agree, but I think that method should be get_ordering().
>
> > Also I think worrying about 'nonsense' cases is a bit of a
> > distraction, we already support some 'nonsense' cases
> > like .order_by('?', '?')
>
> I grant that that's not a super-strong argument. However, making the
> ordering available is also more flexible -- it allows you to do things
> like copying the ordering between querysets, or modifying the ordering
> based on existing ordering (e.g. reverse the ordering), or other things
> I can't come up with off the top of my head, and which the suggested
> API doesn't enable.
>
> Shai
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers  (Contributions to Django itself)" 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].
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/20171218233351.5e08ebc8.shai%40platonix.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM1G14n8fSuyAmuYBaevKNw%3DnWv7kkP6e-xj6y18-RUdfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to