Merge branch 'feature/nearest_establishments_fix' into 'develop'

Fixed nearest establishments search

See merge request gm/gm-backend!106
This commit is contained in:
e.stoyushko 2019-11-06 11:35:43 +00:00
commit a485fc1c7f

View File

@ -162,7 +162,7 @@ class EstablishmentNearestRetrieveView(EstablishmentListView, generics.ListAPIVi
qs = super(EstablishmentNearestRetrieveView, self).get_queryset()
if lat and lon and radius and unit:
center = Point(float(lat), float(lon))
center = Point(float(lon), float(lat))
filter_kwargs = {'center': center, 'radius': float(radius), 'unit': unit}
return qs.by_distance_from_point(**{k: v for k, v in filter_kwargs.items()
if v is not None})