Skip to content

Commit

Permalink
fixed 'source_expressions'
Browse files Browse the repository at this point in the history
(cherry picked from commit 9a34a2a)
  • Loading branch information
tyaslab authored and vdboor committed Apr 8, 2015
1 parent 6404612 commit 135feaf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions polymorphic/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ def patch_lookup(a):
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

Expand Down

0 comments on commit 135feaf

Please sign in to comment.