diff options
| author | Tim Graham <timograham@gmail.com> | 2015-03-13 15:40:25 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-13 15:42:03 -0400 |
| commit | 5b91802718b61346967e7991cf3585554c4c97fa (patch) | |
| tree | 569d25f62fbf4ded765d601c684ea968a48f7712 | |
| parent | 937c8a5a14c08aa3991a5774dae8db60b611dbac (diff) | |
[1.8.x] Refs #24462 -- Emphasized that order_by() clears previous ordering.
Backport of b9d9ab23bdcc404708aada664e718a9d56415ca3 from master
| -rw-r--r-- | docs/ref/models/querysets.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 7ffc54e9da..677d07be25 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -393,6 +393,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 |
