Skip to content

Commit

Permalink
[1.7.x] Refs #24462 -- Emphasized that order_by() clears previous ord…
Browse files Browse the repository at this point in the history
…ering.

Backport of b9d9ab2 from master
  • Loading branch information
timgraham committed Mar 13, 2015
1 parent 9bb451a commit f8ed647
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/ref/models/querysets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
``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::

Ordering is not a free operation. Each field you add to the ordering
Expand Down

0 comments on commit f8ed647

Please sign in to comment.