Skip to content

Commit

Permalink
Fix compatibility issue introduced by renaming of ExpressionNode in D…
Browse files Browse the repository at this point in the history
…jango.
  • Loading branch information
spectras committed Mar 18, 2015
1 parent 8b9e22b commit 0903ff9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hvad/query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import django
from django.db.models import Q, FieldDoesNotExist
from django.db.models.expressions import ExpressionNode
if django.VERSION >= (1, 8):
from django.db.models.expressions import Expression
else:
from django.db.models.expressions import ExpressionNode as Expression
from django.db.models.sql.where import WhereNode
from collections import namedtuple

Expand Down Expand Up @@ -118,7 +121,7 @@ def expression_nodes(expression):
expression = todo.pop()
if expression is not None:
yield expression
if isinstance(expression, ExpressionNode):
if isinstance(expression, Expression):
todo.extend(expression.get_source_expressions())

else:
Expand All @@ -131,7 +134,7 @@ def expression_nodes(expression):
expression = todo.pop()
if expression is not None:
yield expression
if isinstance(expression, ExpressionNode):
if isinstance(expression, Expression):
todo.extend(expression.children or ())


Expand Down

0 comments on commit 0903ff9

Please sign in to comment.