My question is pretty much the same as this. But its quite old and it feels like it must be a fairly common scenario that there might be a better solution to.
I have a model that is something like:
class Person(models.Model):
location = models.PointField(srid=4326)
willing_to_travel = models.IntegerField()
If I want all instances of Person who are within a set distance (e.g. 10 miles) of a point p
, I can do it like this:
Person.objects.filter(location__distance_lte=(p, D(mi=10)))
But I would like to get all instances of Person who are within their willing_to_travel
distance of a particular location.