djangodocs.org

1413 sections across all versions Narrow to Django 6.0 (current) →

hour

Reference QuerySet API reference

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

dev

minute

Reference QuerySet API reference

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

dev

second

Reference QuerySet API reference

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

dev

isnull

Reference QuerySet API reference

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

dev

regex

Reference QuerySet API reference

Case-sensitive regular expression match. The regular expression syntax is that of the database backend in use.

dev

expressions

Reference QuerySet API reference QuerySet APIAggregation functions

Strings that reference fields on the model, transforms of the field, or query expressions.

output_field

Reference QuerySet API reference

An optional argument that represents the model field of the return value NOTE: When combining multiple field types, Django can only determine the > output_field if all fields are of the same type.

dev

BitAnd

Reference QuerySet API reference

classBitAnd(expression,filter=None,default=None,**extra)[source] : > NOTE: > > Added in version 6.1.

dev

BitOr

Reference QuerySet API reference

classBitOr(expression,filter=None,default=None,**extra)[source] : > NOTE: > > Added in version 6.1.

dev

BitXor

Reference QuerySet API reference

classBitXor(expression,filter=None,default=None,**extra)[source] : > NOTE: > > Added in version 6.1.

dev

Count

Reference QuerySet API reference

classCount(expression,distinct=False,filter=None,**extra)[source] : Returns the number of objects that are related through the provided expression. Count('*') is equivalent to the SQL COUNT(*) expression.

dev

Q() objects

Reference QuerySet API reference

classQ[source] A Q() object represents an SQL condition that can be used in database-related operations. It’s similar to how an F() object represents the value of a model field or annotation. They make it possible to define and reuse conditions.

dev

values_list()

Reference QuerySet API reference QuerySet APIMethods that return new QuerySets

values_list(*fields,flat=False,named=False) This is similar to values() except that instead of returning dictionaries, it returns tuples when iterated over.

4.2 5.0 5.1 5.2 6.0

create()

Reference QuerySet API reference QuerySet APIMethods that do not return QuerySets

create(**kwargs) acreate(**kwargs) Asynchronous version: acreate() A convenience method for creating an object and saving it all in one step. Thus: and: are equivalent.

4.2 5.0 5.1 5.2 6.0

bulk_create()

Reference QuerySet API reference QuerySet APIMethods that do not return QuerySets

bulk_create(objs,batch_size=None,ignore_conflicts=False,update_conflicts=False,update_fields=None,unique_fields=None) abulk_create(objs,batch_size=None,ignore_conflicts=False,update_conflicts=False,update_fields=None,unique_fields=None) Asynchronous version: abulk_create() This method inserts the provided list of objects into the database in an efficient manner (generally only 1 query, no matter how many objects there are), and returns created objects as a list, in the …

4.2 5.0 5.1 5.2 6.0

With server-side cursors

Reference QuerySet API reference QuerySet APIMethods that do not return QuerySetsiterator()

Oracle and PostgreSQL use server-side cursors to stream results from the database without loading the entire result set into memory. The Oracle database driver always uses server-side cursors.

4.2 5.0 5.1 5.2 6.0

exact

Reference QuerySet API reference QuerySet APIField lookups

Exact match. If the value provided for comparison is None, it will be interpreted as an SQL NULL (see isnull for more details).

4.2 5.0 5.1 5.2 6.0