Opened 15 years ago

Closed 15 years ago

Last modified 12 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: no UI/UX: no

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 15 years ago.
added 'gte' and 'lte' to the list.
related_field_lookup_patch_1_test.diff (755 bytes ) - added by Andy Durdin 15 years ago.
Patch just containing a regression test

Download all attachments as: .zip

Change History (13)

comment:1 by Rob Hudson <treborhudson@…>, 15 years ago

Component: UncategorizedDatabase layer (models, ORM)

comment:2 by Jacob, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 by kgrandis, 15 years ago

Owner: changed from nobody to kgrandis
Status: newassigned

comment:4 by kgrandis, 15 years ago

Owner: kgrandis removed
Status: assignednew

comment:5 by joelhooks, 15 years ago

Owner: set to joelhooks

by joelhooks, 15 years ago

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

comment:6 by joelhooks, 15 years ago

Has patch: set

comment:7 by Jeremy Dunck, 15 years ago

Needs tests: set

comment:8 by Andy Durdin, 15 years ago

Owner: changed from joelhooks to Andy Durdin
Status: newassigned

by Andy Durdin, 15 years ago

Patch just containing a regression test

comment:9 by Andy Durdin, 15 years ago

Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:10 by Jacob, 15 years ago

Resolution: fixed
Status: assignedclosed

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

comment:11 by Jacob, 12 years ago

milestone: 1.1

Milestone 1.1 deleted

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