summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-11 23:40:34 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-11 23:40:34 +0000
commit54c313af601b07d8fbf2a7a3f24524bf6bd4ed8d (patch)
tree8101f60f6c24b5bfa9ee654297066caae5d461d9 /tests
parent942e5246accda3d953b4634a010402ef5786c2e0 (diff)
Added a quick regression test that shows why Meta.ordering and order_by()
aren't always equivalent. This is documented, stable behaviour, so we should ensure it doesn't change accidentally. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8312 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/models.py b/tests/regressiontests/queries/models.py
index bbd3ef7407..05e1777916 100644
--- a/tests/regressiontests/queries/models.py
+++ b/tests/regressiontests/queries/models.py
@@ -909,8 +909,15 @@ Traceback (most recent call last):
...
FieldError: Infinite loop caused by ordering.
+# Note that this doesn't cause an infinite loop, since the default ordering on
+# the Tag model is empty (and thus defaults to using "id" for the related
+# field).
+>>> len(Tag.objects.order_by('parent'))
+5
+
# ... but you can still order in a non-recursive fashion amongst linked fields
# (the previous test failed because the default ordering was recursive).
>>> LoopX.objects.all().order_by('y__x__y__x__id')
[]
+
"""