Each expression must be able to define it's own ordering because order_by
allows you to define a sort based upon multiple expressions.


On Mon, Jun 9, 2014 at 4:00 PM, Daniel Moisset <[email protected]>
wrote:

> I see everyone trying to put the direction (ascending vs decending) inside
> the expression, while it's actually a property of the ordering clause.
> Wouldn't it make more sense and avoid ambiguities to do:
>
> qs.order_by(..., descending=True)
>
> ?
>
> Then you can add functions (and even a __neg__ operator to fields mapped
> to SQL unary minus) and still have a clear separation of functions vs order
> direction.
>
> D.
>
>
>
> On Mon, Jun 9, 2014 at 4:44 PM, Tim Martin <[email protected]> wrote:
>
>> My concern about the filter(foobar_lt=-F('baz')) issue is that it
>> violates the principle of least surprise: it will be accepted silently and
>> do something that nobody could expect unless they know a bit about the
>> internals. However, I think having some special case code in filter(),
>> annotate() and anything else that takes expressions would be OK. Provided
>> it throws some kind of exception, I think it resolves my concern.
>>
>> I'll go ahead and try to implement this using __neg__() to invert the
>> ordering.
>>
>> Tim
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers" 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 http://groups.google.com/group/django-developers.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/20cd8bd0-9d5d-4ed3-9748-1412188e6726%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-developers/20cd8bd0-9d5d-4ed3-9748-1412188e6726%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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 http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CALuYSZVYnXHapfvf5SwPJxLYkxiv%3DTPyJg2XYGFVhCPSyc7Fgw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CALuYSZVYnXHapfvf5SwPJxLYkxiv%3DTPyJg2XYGFVhCPSyc7Fgw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAGdCwBuHBtQLsVEeftfZAVrx6hdZSvz9ED%3DMmjZvyg%2B--%3D6moQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to