Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #7098 -- Old-style related-model order_by() syntax was being in…

…correctly

marked as erroneous. It's just more dangerous and risky, not forbidden. This
commit restores backwards compatibility there.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7490 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 356dfd5308aeace4c2f46405debbbac37890e0bb 1 parent 6d98636
@malcolmt malcolmt authored
View
2  django/db/models/sql/constants.py
@@ -28,7 +28,7 @@
MULTI = 'multi'
SINGLE = 'single'
-ORDER_PATTERN = re.compile(r'\?|[-+]?\w+$')
+ORDER_PATTERN = re.compile(r'\?|[-+]?[.\w]+$')
ORDER_DIR = {
'ASC': ('ASC', 'DESC'),
'DESC': ('DESC', 'ASC')}
View
4 tests/regressiontests/queries/models.py
@@ -654,5 +654,9 @@ class Meta:
>>> s = qs.query.as_sql()
>>> s = qs.query.as_sql() # test passes if this doesn't raise an exception.
+Bug #7098 -- Make sure semi-deprecated ordering by related models syntax still
+works.
+>>> Item.objects.values('note__note').order_by('queries_note.note', 'id')
+[{'note__note': u'n2'}, {'note__note': u'n3'}, {'note__note': u'n3'}, {'note__note': u'n3'}]
"""}

0 comments on commit 356dfd5

Please sign in to comment.
Something went wrong with that request. Please try again.