fixed 'source_expressions'

(cherry picked from commit 9a34a2a5017499bb12512b2387de49aa2c40fc88)
fix_request_path_info
tyaslab 2015-04-08 09:35:38 +07:00 committed by Diederik van der Boor
parent 640461216b
commit 135feaf905
1 changed files with 3 additions and 2 deletions

View File

@ -103,8 +103,9 @@ class PolymorphicQuerySet(QuerySet):
else: else:
# With Django > 1.8, the field on which the aggregate operates is # With Django > 1.8, the field on which the aggregate operates is
# stored inside a query expression. # stored inside a query expression.
a.source_expressions[0].name = translate_polymorphic_field_path( if hasattr(a, 'source_expressions'):
self.model, a.source_expressions[0].name) 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 get_lookup = lambda a: a.lookup if django.VERSION < (1, 8) else a.source_expressions[0].name