mirror of
https://github.com/django/django.git
synced 2025-05-07 15:36:29 +00:00
[1.7.x] Refs #24462 -- Emphasized that order_by() clears previous ordering.
Backport of b9d9ab23bdcc404708aada664e718a9d56415ca3 from master
This commit is contained in:
parent
9bb451aedb
commit
f8ed647435
@ -348,6 +348,11 @@ You can tell if a query is ordered or not by checking the
|
|||||||
:attr:`.QuerySet.ordered` attribute, which will be ``True`` if the
|
:attr:`.QuerySet.ordered` attribute, which will be ``True`` if the
|
||||||
``QuerySet`` has been ordered in any way.
|
``QuerySet`` has been ordered in any way.
|
||||||
|
|
||||||
|
Each ``order_by()`` call will clear any previous ordering. For example, this
|
||||||
|
query will be ordered by ``pub_date`` and not ``headline``::
|
||||||
|
|
||||||
|
Entry.objects.order_by('headline').order_by('pub_date')
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
Ordering is not a free operation. Each field you add to the ordering
|
Ordering is not a free operation. Each field you add to the ordering
|
||||||
|
Loading…
x
Reference in New Issue
Block a user