Opened 3 months ago

Last modified 3 months ago

#29168 new Cleanup/optimization

Document how to write a custom lookup where the rhs comes before the lhs

Reported by: JJ Gutierrez Owned by: nobody
Component: Database layer (models, ORM) Version: 2.0
Severity: Normal Keywords: lookup
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The page for creating custom field lookups is incomplete. I am referring to the doc at The documentation is unclear about how to use the left-hand side value (lhs) and right-hand side value (rhs) properly. For example, lets say you have a lookup like


The lhs is the ID field and the rhs is the 'abc123'. I want to create a query like

WHERE 'abc123' LIKE id||%

However the documentation is unclear about how to reference the lhs in the as_sql method. Users would like to know how to reference the rhs BEFORE the LIKE and the lhs AFTER the LIKE in the sql query above. The documentation only shows examples where the lhs comes first and the rhs last. This would help users create a custom lookup with the sql above.

Change History (1)

comment:1 Changed 3 months ago by Tim Graham

Summary: Custom lookup documentation is incompleteDocument how to write a custom lookup where the rhs comes before the lhs
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

Maybe looking at the built in lookups would offer a hint.

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