Skip to content

Commit 346d02c

Browse files
committed
Replace deprecated Point.get_coords() calls
This works as far back as Django 1.8, which is the earliest which we support. See django-haystack#1454
1 parent 5443f60 commit 346d02c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

haystack/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def prepare(self, obj):
223223
return None
224224

225225
pnt = ensure_point(value)
226-
pnt_lng, pnt_lat = pnt.get_coords()
226+
pnt_lng, pnt_lat = pnt.coords
227227
return "%s,%s" % (pnt_lat, pnt_lng)
228228

229229
def convert(self, value):

haystack/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _get_distance(self):
127127
if not hasattr(self, self._point_of_origin['field']):
128128
raise SpatialError("The field '%s' was not included in search results, so the distance could not be calculated." % self._point_of_origin['field'])
129129

130-
po_lng, po_lat = self._point_of_origin['point'].get_coords()
130+
po_lng, po_lat = self._point_of_origin['point'].coords
131131
location_field = getattr(self, self._point_of_origin['field'])
132132

133133
if location_field is None:

test_haystack/test_managers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_order_by_distance(self):
8787
self.assertIn('distance_point', params)
8888
self.assertDictEqual(params['distance_point'], {'field': 'location',
8989
'point': p})
90-
self.assertTupleEqual(params['distance_point']['point'].get_coords(), (1.23, 4.56))
90+
self.assertTupleEqual(params['distance_point']['point'].coords, (1.23, 4.56))
9191

9292
self.assertListEqual(params['sort_by'], ['distance'])
9393

0 commit comments

Comments
 (0)