Ticket #11722: incorrect_fix.diff

File incorrect_fix.diff, 1.1 KB (added by plandry@…, 15 years ago)

A patch that illustrates a fix for this case, but is not a permanent fix

Line 
1Index: django/db/models/sql/where.py
2===================================================================
3--- django/db/models/sql/where.py (revision 11453)
4+++ django/db/models/sql/where.py (working copy)
5@@ -159,12 +159,18 @@
6
7 if hasattr(params, 'as_sql'):
8 extra, params = params.as_sql(qn)
9- cast_sql = ''
10+ cast_sql = '%s'
11 else:
12 extra = ''
13
14 if lookup_type in connection.operators:
15 format = "%s %%s %%s" % (connection.ops.lookup_cast(lookup_type),)
16 return (format % (field_sql,
17 connection.operators[lookup_type] % cast_sql,
18 extra), params)
19Index: django/db/models/sql/expressions.py
20===================================================================
21--- django/db/models/sql/expressions.py (revision 11453)
22+++ django/db/models/sql/expressions.py (working copy)
23@@ -85,4 +85,4 @@
24 if hasattr(col, 'as_sql'):
25 return col.as_sql(qn), ()
26 else:
27- return '%s.%s' % (qn(col[0]), qn(col[1])), ()
28+ return '', ('%s.%s' % (qn(col[0]), qn(col[1])),)
Back to Top