Last active
August 29, 2015 14:24
-
-
Save octaflop/bd12efa339af52b56ae4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.gis.measure import D | |
from django.contrib.gis.geos import Point | |
SRID = 4326 | |
pnt = Point(lat, lon, srid=SRID) | |
class Location(models.Model): | |
point = models.PointField() | |
objects = models.GeoManager() | |
campuses = Location.objects.filter( | |
point__distance_lte=(pnt, D(mi=1))) | |
# raises: "distance_lte is not a valid spatial lookup for PointField" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment