Ticket #5498: gis_5498.diff
File gis_5498.diff, 1.5 KB (added by , 17 years ago) |
---|
-
django/contrib/gis/db/backend/postgis/field.py
1 1 from django.db.models.fields import Field # Django base Field class 2 2 from django.contrib.gis.geos import GEOSGeometry, GEOSException 3 from django.contrib.gis.db.backend.postgis.query import POSTGIS_TERMS, geo_quotename as quotename3 from django.contrib.gis.db.backend.postgis.query import POSTGIS_TERMS, GEOM_FUNC_PREFIX, geo_quotename as quotename 4 4 from types import StringType 5 5 6 6 class PostGISField(Field): … … 77 77 # Returning a dictionary instructs the parse_lookup() to add 78 78 # what's in the 'where' key to the where parameters, since we 79 79 # need to transform the geometry in the query. 80 return {'where' : [ "ST_Transform(%s,%s)"],80 return {'where' : [GEOM_FUNC_PREFIX+"Transform(%s,%s)"], 81 81 'params' : [value, self._srid] 82 82 } 83 83 else: … … 104 104 "Provides a proper substitution value for " 105 105 if isinstance(value, GEOSGeometry) and value.srid != self._srid: 106 106 # Adding Transform() to the SQL placeholder. 107 return 'ST_Transform(%%s, %s)' % self._srid107 return GEOM_FUNC_PREFIX+'Transform(%%s, %s)' % self._srid 108 108 else: 109 109 return '%s'