I don't want to go through the pain of installing PostGIS so can I get places ordered by distance from an origin using django.contrib.gis
?
models.py
from django.contrib.gis.geos import Point
class Place(models.Model):
name = models.CharField(max_length=50)
lat = models.FloatField()
lng = models.FloatField()
def point(self):
return Point(self.lat,self.lng)
views.py
origin = Point(lookup_lat,lookup_lng)
places = Place.objects.filter(point__distance_lte=(origin, D(mi=10))).distance(origin).order_by('distance')[:20]
I've tried this but I get Cannot resolve keyword 'point' into field.