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

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
This commit is contained in:
Malcolm Tredinnick 2008-04-28 02:27:19 +00:00
parent 6d98636018
commit 356dfd5308
2 changed files with 5 additions and 1 deletions

View File

@ -28,7 +28,7 @@ NULLABLE = 6
MULTI = 'multi' MULTI = 'multi'
SINGLE = 'single' SINGLE = 'single'
ORDER_PATTERN = re.compile(r'\?|[-+]?\w+$') ORDER_PATTERN = re.compile(r'\?|[-+]?[.\w]+$')
ORDER_DIR = { ORDER_DIR = {
'ASC': ('ASC', 'DESC'), 'ASC': ('ASC', 'DESC'),
'DESC': ('DESC', 'ASC')} 'DESC': ('DESC', 'ASC')}

View File

@ -654,5 +654,9 @@ Bug #7045 -- extra tables used to crash SQL construction on the second use.
>>> s = qs.query.as_sql() >>> s = qs.query.as_sql()
>>> s = qs.query.as_sql() # test passes if this doesn't raise an exception. >>> 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'}]
"""} """}