Ticket #5498: gis_5498.diff

File gis_5498.diff, 1.5 KB (added by Robert Coup, 17 years ago)

use GEOM_FUNC_PREFIX in backend.postgis.field

  • django/contrib/gis/db/backend/postgis/field.py

     
    11from django.db.models.fields import Field # Django base Field class
    22from django.contrib.gis.geos import GEOSGeometry, GEOSException
    3 from django.contrib.gis.db.backend.postgis.query import POSTGIS_TERMS, geo_quotename as quotename
     3from django.contrib.gis.db.backend.postgis.query import POSTGIS_TERMS, GEOM_FUNC_PREFIX, geo_quotename as quotename
    44from types import StringType
    55
    66class PostGISField(Field):
     
    7777                    # Returning a dictionary instructs the parse_lookup() to add
    7878                    # what's in the 'where' key to the where parameters, since we
    7979                    # need to transform the geometry in the query.
    80                     return {'where' : ["ST_Transform(%s,%s)"],
     80                    return {'where' : [GEOM_FUNC_PREFIX+"Transform(%s,%s)"],
    8181                            'params' : [value, self._srid]
    8282                            }
    8383                else:
     
    104104        "Provides a proper substitution value for "
    105105        if isinstance(value, GEOSGeometry) and value.srid != self._srid:
    106106            # Adding Transform() to the SQL placeholder.
    107             return 'ST_Transform(%%s, %s)' % self._srid
     107            return GEOM_FUNC_PREFIX+'Transform(%%s, %s)' % self._srid
    108108        else:
    109109            return '%s'
Back to Top