From 62a9ed0ac761bc737ba355519bb209517b330039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Tue, 14 Aug 2012 15:43:33 +0300 Subject: [PATCH] [py3] Fixed F-expression division operators In Python 3 dividing by int will call obj.__truediv__(). This operator was missing from F-expressions. --- django/db/models/expressions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index a71f4a33ef..eb5e7d6fd9 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -58,8 +58,9 @@ class ExpressionNode(tree.Node): 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)