diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2016-12-08 20:48:26 +0600 |
|---|---|---|
| committer | Simon Charette <charettes@users.noreply.github.com> | 2016-12-08 09:48:26 -0500 |
| commit | 82fd779af5bce50cb24adc3ed7b7811da369f6a2 (patch) | |
| tree | c2db00e5f1622380ca1819b22805b31259d73fdb | |
| parent | 413216fb9fb36c064494fe155effc39e2888161e (diff) | |
Simplified Transform GIS function by setting output_field.
| -rw-r--r-- | django/contrib/gis/db/models/functions.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py index 1cec34d2bf..2301a50230 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): |
