Cleaned up the ORM slightly.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15203 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2011-01-14 05:04:14 +00:00
parent 7916c754aa
commit 92d4352283
1 changed files with 7 additions and 7 deletions

View File

@ -1212,11 +1212,10 @@ class Query(object):
dupe_set = set() dupe_set = set()
exclusions = set() exclusions = set()
extra_filters = [] extra_filters = []
int_alias = None
for pos, name in enumerate(names): for pos, name in enumerate(names):
try: if int_alias is not None:
exclusions.add(int_alias) exclusions.add(int_alias)
except NameError:
pass
exclusions.add(alias) exclusions.add(alias)
last.append(len(joins)) last.append(len(joins))
if name == 'pk': if name == 'pk':
@ -1375,10 +1374,11 @@ class Query(object):
joins.append(alias) joins.append(alias)
for (dupe_opts, dupe_col) in dupe_set: for (dupe_opts, dupe_col) in dupe_set:
try: if int_alias is None:
self.update_dupe_avoidance(dupe_opts, dupe_col, int_alias) to_avoid = alias
except NameError: else:
self.update_dupe_avoidance(dupe_opts, dupe_col, alias) to_avoid = int_alias
self.update_dupe_avoidance(dupe_opts, dupe_col, to_avoid)
if pos != len(names) - 1: if pos != len(names) - 1:
if pos == len(names) - 2: if pos == len(names) - 2: