diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py index 1cec34d2bf8..2301a502303 100644 --- a/django/contrib/gis/db/models/functions.py +++ b/django/contrib/gis/db/models/functions.py @@ -425,6 +425,8 @@ class Transform(GeoFunc): expression, 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) @property @@ -432,13 +434,6 @@ class Transform(GeoFunc): # Make srid the resulting srid of the transformation 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): def as_sqlite(self, compiler, connection):