Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10153 closed (fixed)

'gte' missing in get_db_prep_lookup lookup

Reported by: gatwanagu Owned by: adurdin
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 5 years ago.
added 'gte' and 'lte' to the list.
related_field_lookup_patch_1_test.diff (755 bytes) - added by adurdin 5 years ago.
Patch just containing a regression test

Download all attachments as: .zip

Change History (13)

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

  • Component changed from Uncategorized to Database layer (models, ORM)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by kgrandis

  • Owner changed from nobody to kgrandis
  • Status changed from new to assigned

comment:4 Changed 5 years ago by kgrandis

  • Owner kgrandis deleted
  • Status changed from assigned to new

comment:5 Changed 5 years ago by joelhooks

  • Owner set to joelhooks

Changed 5 years ago by joelhooks

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

comment:6 Changed 5 years ago by joelhooks

  • Has patch set

comment:7 Changed 5 years ago by jdunck

  • Needs tests set

comment:8 Changed 5 years ago by adurdin

  • Owner changed from joelhooks to adurdin
  • Status changed from new to assigned

Changed 5 years ago by adurdin

Patch just containing a regression test

comment:9 Changed 5 years ago by adurdin

  • Needs tests unset
  • Triage Stage changed from Accepted to Ready for checkin

comment:10 Changed 5 years ago by jacob

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:11 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.