Filter Qualifiers

When specifying selection criteria using field-value pair parameters, these qualifiers can be applied to field values to filter results.

See QuerySet API reference - Field lookups for a detailed description of each qualifier in the Django documentation.

Syntax

<field>__<qualifier>=<value>

Note: There are two underscore characters between the field and qualifier names.

Qualifiers

Important: The datatype of the specified value(s) must match the expected field datatype.

exact iexact contains icontains
in gt gte lt
lte startswith istartswith endswith
iendswith range year month
day week_day isnull search
regex iregex

exact

Return element(s) whose value for the specified field is an exact match (case-sensitive). Example:

library__exact=E_coli_dh10b

iexact

Return element(s) whose value for the specified field is an exact match (case-insensitive). Example:

library__iexact=E_coli_dh10b

contains

Return element(s) whose value for the specified field contains the specified value (case-sensitive). (See also search.) Example:

library__contains=E_coli

icontains

Return element(s) whose value for the specified field contains the specified value (case-insensitive). Example:

library__icontains=E_coli

in

Return element(s) whose value for the specified field is in the specified list. Example:

id__in=[1, 3, 4]

gt

Return element(s) whose value for the specified field is greater than the specified value. Example:

name__gt=B4

gte

Return element(s) whose value for the specified field is greater than or equal to the specified value. Example:

name__gte=B4

lt

Return element(s) whose value for the specified field is less than the specified value. Example:

name__lt=B24

lte

Return element(s) whose value for the specified field is less than or equal to the specified value. Example:

name__lte=B24

startswith

Return element(s) whose value for the specified field starts with the specified value (case-sensitive). Example:

library__startswith=E_coli

istartswith

Return element(s) whose value for the specified field starts with the specified value (case-insensitive). Example:

library__istartswith=E_coli

endswith

Return element(s) whose value for the specified field ends with the specified value (case-sensitive). Example:

library__endswith=dh10b

iendswith

Return element(s) whose value for the specified field ends with the specified value (case-insensitive). Example:

library__iendswith=dh10b

range

Return element(s) whose value for the specified field is in the range of the specified values (inclusive). Example:

date__range=(start_date, end_date))

year

Return element(s) whose value for the specified date/datetime field matches the specified year. Example:

date__year=2013

month

Return element(s) whose value for the specified date/datetime field matches the specified integer month. Example:

date__month=6

day

Return element(s) whose value for the specified date/datetime field matches the specified integer day-of-month. Example:

date__day=17

week_day

Return element(s) whose value for the specified date/datetime field matches the specified integer day-of-week, where Sunday = 1 and Saturday = 7. Example:

date__week_day=2

isnull

Return element(s) whose value for the specified field is NULL, where True = NULL and False = NOT NULL. Example:

date__isnull=True

regex

Return element(s) whose value for the specified field matches the regular expression (case-sensitive). Example:

name__regex=r'^(An?|The) +'

iregex

Return element(s) whose value for the specified field matches the regular expression (case-insensitive). Example:

name__iregex=r'^(an?|the) +'

Table of contents

Previous topic

Fields

Next topic

Debug API Errors

This Page