MCPcopy Index your code
hub / github.com/django-haystack/django-haystack / prepare

Method prepare

haystack/fields.py:248–258  ·  view source on GitHub ↗
(self, obj)

Source from the content-addressed store, hash-verified

246 field_type = "location"
247
248 def prepare(self, obj):
249 from haystack.utils.geo import ensure_point
250
251 value = super().prepare(obj)
252
253 if value is None:
254 return None
255
256 pnt = ensure_point(value)
257 pnt_lng, pnt_lat = pnt.coords
258 return "%s,%s" % (pnt_lat, pnt_lng)
259
260 def convert(self, value):
261 from django.contrib.gis.geos import Point

Callers

nothing calls this directly

Calls 2

ensure_pointFunction · 0.90
prepareMethod · 0.45

Tested by

no test coverage detected