fixed 'source_expressions'

(cherry picked from commit 9a34a2a5017499bb12512b2387de49aa2c40fc88)
This commit is contained in:
tyaslab
2015-04-08 09:35:38 +07:00
committed by Diederik van der Boor
parent 640461216b
commit 135feaf905
+3 -2
View File
@@ -103,8 +103,9 @@ class PolymorphicQuerySet(QuerySet):
else:
# With Django > 1.8, the field on which the aggregate operates is
# stored inside a query expression.
a.source_expressions[0].name = translate_polymorphic_field_path(
self.model, a.source_expressions[0].name)
if hasattr(a, 'source_expressions'):
a.source_expressions[0].name = translate_polymorphic_field_path(
self.model, a.source_expressions[0].name)
get_lookup = lambda a: a.lookup if django.VERSION < (1, 8) else a.source_expressions[0].name