Lookups

Lookups like contains can make searches through the API extremely powerful.

Every filter you define has three parts: Field Name, Lookup, and Value. These parts are formatted as field_name__lookup=value.

While lookups are optional and can be excluded from a filter (like writing project=1701), just imagine there is an implicit exact lookup present if one is missing, like project__exact=1701.

The API supports many different lookup terms:

Term Description
exact Match the value exactly
iexact Match the value exactly (with case insensitivity)
gt Greater Than
gte Greater Than or Equal To
lt Less Than
lte Less Than or Equal To
contains Results contain value
icontains Results contain value (with case insensitivity)
startswith Results start with value
istartswith Results start with value (with case insensitivity)
endswith Results end with value
iendswith Results end with value (with case insensitivity)
isnull Results have a null value
regex Results have value matching regular expression
iregex Results have value matching regular expression (with case insensitivity)

Timestamp fields support other kinds of lookups:

Term
year
month
day
week_day
iso_week_day
week
iso_year
quarter
hour
minute
second
date
time

Lookup Limitations

Not all lookup terms are supported for all fields. For example, you can't use contains on an integer field, since that would be nonsensical.