djangodocs.org

674 sections in Django 4.2 Search all versions →

startswith

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive starts-with. Example: SQL equivalent: SQLite doesn’t support case-sensitive LIKE statements; startswith acts like istartswith for SQLite.

istartswith

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive starts-with. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

endswith

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive ends-with. Example: SQL equivalent: NOTE: SQLite doesn’t support case-sensitive LIKE statements; endswith > acts like iendswith for SQLite. Refer to the database note documentation for more.

iendswith

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive ends-with. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

range

Reference QuerySet API reference QuerySet APIField lookups

Range test (inclusive). Example: SQL equivalent: You can use range anywhere you can use BETWEEN in SQL — for dates, numbers and even characters.

date

Reference QuerySet API reference QuerySet APIField lookups

For datetime fields, casts the value as date. Allows chaining additional field lookups. Takes a date value.

year

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, an exact year match. Allows chaining additional field lookups. Takes an integer year.

iso_year

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, an exact ISO 8601 week-numbering year match. Allows chaining additional field lookups. Takes an integer year.

month

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, an exact month match. Allows chaining additional field lookups. Takes an integer 1 (January) through 12 (December).

day

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, an exact day match. Allows chaining additional field lookups. Takes an integer day.

week

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, return the week number (1-52 or 53) according to ISO-8601, i.e., weeks start on a Monday and the first week contains the year’s first Thursday.

week_day

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, a ‘day of the week’ match. Allows chaining additional field lookups. Takes an integer value representing the day of week from 1 (Sunday) to 7 (Saturday).

iso_week_day

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, an exact ISO 8601 day of the week match. Allows chaining additional field lookups. Takes an integer value representing the day of the week from 1 (Monday) to 7 (Sunday).

quarter

Reference QuerySet API reference QuerySet APIField lookups

For date and datetime fields, a ‘quarter of the year’ match. Allows chaining additional field lookups. Takes an integer value between 1 and 4 representing the quarter of the year.

time

Reference QuerySet API reference QuerySet APIField lookups

For datetime fields, casts the value as time. Allows chaining additional field lookups. Takes a datetime.time value.

hour

Reference QuerySet API reference QuerySet APIField lookups

For datetime and time fields, an exact hour match. Allows chaining additional field lookups. Takes an integer between 0 and 23.

minute

Reference QuerySet API reference QuerySet APIField lookups

For datetime and time fields, an exact minute match. Allows chaining additional field lookups. Takes an integer between 0 and 59.

second

Reference QuerySet API reference QuerySet APIField lookups

For datetime and time fields, an exact second match. Allows chaining additional field lookups. Takes an integer between 0 and 59.

isnull

Reference QuerySet API reference QuerySet APIField lookups

Takes either True or False, which correspond to SQL queries of IS NULL and IS NOT NULL, respectively. Example: SQL equivalent: