Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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...
commit 62a9ed0ac761bc737ba355519bb209517b330039 1 parent c2d59e5
Anssi Kääriäinen authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  django/db/models/expressions.py
3  django/db/models/expressions.py
@@ -58,8 +58,9 @@ def __sub__(self, other):
58 58
     def __mul__(self, other):
59 59
         return self._combine(other, self.MUL, False)
60 60
 
61  
-    def __div__(self, other):
  61
+    def __truediv__(self, other):
62 62
         return self._combine(other, self.DIV, False)
  63
+    __div__ = __truediv__ # Python 2 compatibility
63 64
 
64 65
     def __mod__(self, other):
65 66
         return self._combine(other, self.MOD, False)

0 notes on commit 62a9ed0

Please sign in to comment.
Something went wrong with that request. Please try again.