diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2017-04-03 02:06:01 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-04-02 17:06:01 -0400 |
| commit | 898e623db0fa6b2cf0b187a3db78b675cde111cf (patch) | |
| tree | 4ffd7179e7dd583b2694139df695d5381a1f0e15 /django | |
| parent | 35c0025151ad411e691a2fa62a0dd3507ebafd82 (diff) | |
Fixed #27573 -- Made Distance on geodetic coordinates return a raw value on MySQL.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/db/models/functions.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py index 3dd8efaa22..04e81e5428 100644 --- a/django/contrib/gis/db/models/functions.py +++ b/django/contrib/gis/db/models/functions.py @@ -253,15 +253,13 @@ class DistanceResultMixin: def convert_value(self, value, expression, connection, context): if value is None: return None + dist_att = None geo_field = self.geo_field if geo_field.geodetic(connection): - dist_att = 'm' + if connection.features.supports_distance_geodetic: + dist_att = 'm' else: - units = geo_field.units_name(connection) - if units: - dist_att = DistanceMeasure.unit_attname(units) - else: - dist_att = None + dist_att = geo_field.units_name(connection) if dist_att: return DistanceMeasure(**{dist_att: value}) return value |
