mirror of https://github.com/django/django.git
Simplified Transform GIS function by setting output_field.
This commit is contained in:
parent
413216fb9f
commit
82fd779af5
|
@ -425,6 +425,8 @@ class Transform(GeoFunc):
|
||||||
expression,
|
expression,
|
||||||
self._handle_param(srid, 'srid', six.integer_types),
|
self._handle_param(srid, 'srid', six.integer_types),
|
||||||
]
|
]
|
||||||
|
if 'output_field' not in extra:
|
||||||
|
extra['output_field'] = GeometryField(srid=srid)
|
||||||
super(Transform, self).__init__(*expressions, **extra)
|
super(Transform, self).__init__(*expressions, **extra)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -432,13 +434,6 @@ class Transform(GeoFunc):
|
||||||
# Make srid the resulting srid of the transformation
|
# Make srid the resulting srid of the transformation
|
||||||
return self.source_expressions[self.geom_param_pos + 1].value
|
return self.source_expressions[self.geom_param_pos + 1].value
|
||||||
|
|
||||||
def convert_value(self, value, expression, connection, context):
|
|
||||||
value = super(Transform, self).convert_value(value, expression, connection, context)
|
|
||||||
if not connection.ops.postgis and not value.srid:
|
|
||||||
# Some backends do not set the srid on the returning geometry
|
|
||||||
value.srid = self.srid
|
|
||||||
return value
|
|
||||||
|
|
||||||
|
|
||||||
class Translate(Scale):
|
class Translate(Scale):
|
||||||
def as_sqlite(self, compiler, connection):
|
def as_sqlite(self, compiler, connection):
|
||||||
|
|
Loading…
Reference in New Issue