Lookup
PronunciationLOOK-up
Definition
A lookup is a filter operator you attach to a field name in an ORM query, such as amount__gte=100 or name__icontains="ali", to say how to compare it.
Where you hear it
In Django queries (filter(), exclude()), ORM docs, and code reviews on search features.
Examples
Use
__gteto get payments of at least 100.__icontainsignores upper and lower case.Filtering with name__icontains matches both Ali and ali.
Common mistake
Using __contains for case-insensitive search. It is case-sensitive; use __icontains.
Don't confuse with
A SQL WHERE clause, which is the raw form. A lookup is the ORM's way of writing the same condition.
Say it at work
- In a meeting or chat
Chain two lookups to narrow it down.
- In an email or ticket
Which lookup would match the beginning of the name?