#27448: GIS distance queries use deprecated ST_distance_sphere
-------------------------------------+-------------------------------------
Reporter: Christian von | Owner: Mjumbe
Roques | Poe
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: GIS distance | Triage Stage: Accepted
deprecated ST_distance_sphere |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Claude Paroz):
In `PostGISDistanceOperator`, you should be able to check
`connection.ops.spatial_version`. Then for testing, you should be able to
mock `spatial_version` with something like:
{{{
with
mock.patch('django.contrib.gis.db.backends.postgis.operations.PostGISOperations.spatial_version',
new_callable=mock.PropertyMock) as mock_spatial_version:
mock_spatial_version.return_value = '2.1.0'
... your test
}}}
I wouldn't care about fixing the deprecated GeoQuerySet API (where mocking
would be more difficult).
--
Ticket URL: <https://code.djangoproject.com/ticket/27448#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.9d5d2261cb7c3f523e8723d90311d17b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.