mirror of
https://github.com/django/django.git
synced 2025-07-06 02:39:12 +00:00
queryset-refactor: Fixed handling of extra(tables=...). In passing, this solves
a duplicate table / bad SQL problem. Refs #2496. git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6504 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
93b4199912
commit
6678de130c
@ -371,7 +371,11 @@ class Query(object):
|
||||
qn(lhs_col), qn(alias), qn(col)))
|
||||
else:
|
||||
result.append('%s%s' % (qn(name), alias_str))
|
||||
result.extend(self.extra_tables)
|
||||
extra_tables = []
|
||||
for t in self.extra_tables:
|
||||
alias, created = self.table_alias(t)
|
||||
if created:
|
||||
result.append(', %s' % alias)
|
||||
return result, []
|
||||
|
||||
def get_grouping(self):
|
||||
|
@ -202,5 +202,9 @@ Bug #2400
|
||||
[<Author: a3>]
|
||||
>>> Tag.objects.filter(item__isnull=True)
|
||||
[<Tag: t5>]
|
||||
|
||||
Bug #2496
|
||||
>>> Item.objects.extra(tables=['queries_author']).select_related().order_by('name')[:1]
|
||||
[<Item: four>]
|
||||
"""}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user