Permalink
Browse files

[py3] Fixed F-expression division operators

In Python 3 dividing by int will call obj.__truediv__(). This operator
was missing from F-expressions.
  • Loading branch information...
1 parent c2d59e5 commit 62a9ed0ac761bc737ba355519bb209517b330039 @akaariai akaariai committed Aug 14, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 django/db/models/expressions.py
@@ -58,8 +58,9 @@ def __sub__(self, other):
def __mul__(self, other):
return self._combine(other, self.MUL, False)
- def __div__(self, other):
+ def __truediv__(self, other):
return self._combine(other, self.DIV, False)
+ __div__ = __truediv__ # Python 2 compatibility
def __mod__(self, other):
return self._combine(other, self.MOD, False)

0 comments on commit 62a9ed0

Please sign in to comment.