Code

Ticket #14110: where.cast.diff

File where.cast.diff, 948 bytes (added by Suor, 4 years ago)
Line 
1Index: django/db/models/sql/where.py
2===================================================================
3--- django/db/models/sql/where.py       (revision 981)
4+++ django/db/models/sql/where.py       (working copy)
5@@ -1,3 +1,4 @@
6+# -*- coding: utf-8 -*-
7 """
8 Code to manage the creation and SQL rendering of 'where' constraints.
9 """
10@@ -168,10 +169,10 @@
11             value_annot = True
12 
13         if lookup_type in connection.operators:
14-            format = "%s %%s %%s" % (connection.ops.lookup_cast(lookup_type),)
15+            format = "%s %%s" % (connection.ops.lookup_cast(lookup_type),)
16             return (format % (field_sql,
17-                              connection.operators[lookup_type] % cast_sql,
18-                              extra), params)
19+                              connection.operators[lookup_type] % (cast_sql or extra)),
20+                              params)
21 
22         if lookup_type == 'in':
23             if not value_annot: