Code

Ticket #11741: django-gis.diff

File django-gis.diff, 1.8 KB (added by jaklaassen@…, 5 years ago)
Line 
1Index: django/contrib/gis/db/models/sql/where.py
2===================================================================
3--- django/contrib/gis/db/models/sql/where.py   (revision 11587)
4+++ django/contrib/gis/db/models/sql/where.py   (working copy)
5@@ -87,7 +87,7 @@
6                 # will be populated in the GeoFieldSQL object returned by the
7                 # GeometryField.
8                 alias, col, db_type = obj
9-                gwc = get_geo_where_clause(alias, col, lookup_type, value_annot)
10+                gwc = get_geo_where_clause(alias, col, lookup_type, value_annot, qn)
11                 return gwc % value_annot.where, params
12             else:
13                 raise TypeError('Invalid lookup type: %r' % lookup_type)
14Index: django/contrib/gis/db/backend/postgis/query.py
15===================================================================
16--- django/contrib/gis/db/backend/postgis/query.py      (revision 11587)
17+++ django/contrib/gis/db/backend/postgis/query.py      (working copy)
18@@ -10,8 +10,6 @@
19 from django.contrib.gis.measure import Distance
20 from django.contrib.gis.db.backend.util import SpatialOperation, SpatialFunction
21 
22-qn = connection.ops.quote_name
23-
24 # Get the PostGIS version information.
25 # To avoid the need to do a database query to determine the PostGIS version
26 # each time the server starts up, one can optionally specify a
27@@ -250,7 +248,7 @@
28     else: return exactly_two(val)
29 
30 #### The `get_geo_where_clause` function for PostGIS. ####
31-def get_geo_where_clause(table_alias, name, lookup_type, geo_annot):
32+def get_geo_where_clause(table_alias, name, lookup_type, geo_annot, qn=connection.ops.quote_name):
33     "Returns the SQL WHERE clause for use in PostGIS SQL construction."
34     # Getting the quoted field as `geo_col`.
35     geo_col = '%s.%s' % (qn(table_alias), qn(name))