Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#10153 closed (fixed)

'gte' missing in get_db_prep_lookup lookup

Reported by: gatwanagu Owned by: Andy Durdin
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords: queryset field lookup
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When using a field lookup

(unit__gte=3)

there is an error "Related Field has invalid lookup: ..." raised, when using the field lookup

(unit__gt=3)

it works fine.

Reason is that in db/models/fields/related.py in the function get_db_prep_lookup the lookup_type is cross checked against a list, and in this list 'gte' is missing.

Inserting 'gte' (and 'lte' to keep it synced) fixes the problem. There is a FIXME about this checking.

I don't understand what is the big difference in handling 'gt' to 'gte' and why 'gte' and 'lte' can't be inserted

Thanks

Günter

Attachments (2)

related_field_lookup_patch_1.diff (723 bytes) - added by joelhooks 7 years ago.
added 'gte' and 'lte' to the list.
related_field_lookup_patch_1_test.diff (755 bytes) - added by Andy Durdin 7 years ago.
Patch just containing a regression test

Download all attachments as: .zip

Change History (13)

comment:1 Changed 8 years ago by Rob Hudson <treborhudson@…>

Component: UncategorizedDatabase layer (models, ORM)
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by kgrandis

Owner: changed from nobody to kgrandis
Status: newassigned

comment:4 Changed 8 years ago by kgrandis

Owner: kgrandis deleted
Status: assignednew

comment:5 Changed 7 years ago by joelhooks

Owner: set to joelhooks

Changed 7 years ago by joelhooks

added 'gte' and 'lte' to the list.

comment:6 Changed 7 years ago by joelhooks

Has patch: set

comment:7 Changed 7 years ago by Jeremy Dunck

Needs tests: set

comment:8 Changed 7 years ago by Andy Durdin

Owner: changed from joelhooks to Andy Durdin
Status: newassigned

Changed 7 years ago by Andy Durdin

Patch just containing a regression test

comment:9 Changed 7 years ago by Andy Durdin

Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:10 Changed 7 years ago by Jacob

Resolution: fixed
Status: assignedclosed

(In [10692]) Fixed #10153: foreign key gte and lte lookups now work. Thanks, joelhooks and adurdin.

comment:11 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top