Avoid OrderedDict creation on lookup aggregate check

This commit is contained in:
Anssi Kääriäinen 2013-11-30 23:10:15 +02:00
parent 7c8b3a32cc
commit 32c04357a8
1 changed files with 4 additions and 3 deletions

View File

@ -1064,9 +1064,10 @@ class Query(object):
Solve the lookup type from the lookup (eg: 'foobar__id__icontains')
"""
lookup_splitted = lookup.split(LOOKUP_SEP)
aggregate, aggregate_lookups = refs_aggregate(lookup_splitted, self.aggregates)
if aggregate:
return aggregate_lookups, (), aggregate
if self._aggregates:
aggregate, aggregate_lookups = refs_aggregate(lookup_splitted, self.aggregates)
if aggregate:
return aggregate_lookups, (), aggregate
_, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())
field_parts = lookup_splitted[0:len(lookup_splitted) - len(lookup_parts)]
if len(lookup_parts) == 0: