#32380 closed New feature (fixed)
GeoDjango lookups should support F() expressions.
Description (last modified by ) ¶
For example, if we need to calculate the distance between two field of the model with the distance_gte
lookup like the following:
return queryset.filter(checkin_position__distance_gte=(F("doctor_location__location__position"), D(km=200)) )
We will get the following error:
ValueError: Cannot use object with type F for a spatial lookup parameter.
Note that doctor_location__location__position
is a PointField
.
Change History (3)
comment:1 by , 4 years ago
Description: | modified (diff) |
---|
comment:2 by , 4 years ago
Cc: | added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Summary: | GeoDjango lookups must be accept F() input → GeoDjango lookups should support F() expressions. |
Version: | 2.2 → 3.0 |
Note:
See TracTickets
for help on using tickets.
This was fixed in 5935a9aeade517aebdceea989467d2b46c44d96f (Django 3.0). I sent PR with extra tests.