I have a list of locations in my database stored as lng and lat. The django views is returning the longitude and latitude and latitude of the user location.I would like to return all the locations in the database within 10km of a users location. What would be the best way to do this?
def feed(request):
latitude = request.session['lat']
longitude = request.session['lng']
radius = 20000
radius = float(radius) / 1000.0 # Distance radius convert m to km
lat = float(latitude) # Central point latitude
lng = float(longitude) # Central point longitude
return render(request,'main/feed.html')