#32380 closed New feature (fixed)
GeoDjango lookups should support F() expressions.
| Reported by: | Mohammad Hasanzadeh | Owned by: | nobody |
|---|---|---|---|
| Component: | GIS | Version: | 3.0 |
| Severity: | Normal | Keywords: | geodjango |
| Cc: | Simon Charette | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
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 , 5 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 5 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.