djangodocs.org

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

Variance

Reference QuerySet API reference QuerySet APIAggregation functions

classVariance(expression,output_field=None,sample=False,filter=None,default=None,**extra)[source] : Returns the variance of the data in the provided expression.

4.2 5.0 5.1 5.2 6.0

StringAgg

Reference QuerySet API reference QuerySet APIAggregation functions

New in Django 6.0. classStringAgg(expression,delimiter,output_field=None,distinct=False,filter=None,order_by=None,default=None,**extra)[source] : Returns the input values concatenated into a string, separated by the delimiter string, or default if there are no values.

6.0

Prefetch() objects

Reference QuerySet API reference Query-related tools

classPrefetch(lookup,queryset=None,to_attr=None)[source] The Prefetch() object can be used to control the operation of prefetch_related(). The lookup argument describes the relations to follow and works the same as the string based lookups passed to prefetch_related().

4.2 5.0 5.1 5.2 6.0

Reference QuerySet API reference Query-related tools

… find restaurants that have vegetarian pizzas with 'mozzarella' in the name: If there are a large number of pizzas, this queryset performs better than: because the filtering in the WHERE clause of the first queryset will only operate on vegetarian …

4.2 5.0 5.1 5.2 6.0

Extent

Reference GIS QuerySet API Reference

classExtent(geo_field,filter=None)[source] Availability: PostGIS, Oracle, SpatiaLite Returns the extent of all geo_field in the QuerySet as a 4-tuple, comprising the lower left coordinate and the upper right coordinate. Example:

dev

Extent3D

Reference GIS QuerySet API Reference

classExtent3D(geo_field,filter=None)[source] Availability: PostGIS Returns the 3D extent of all geo_field in the QuerySet as a 6-tuple, comprising the lower left coordinate and upper right coordinate (each with x, y, and z coordinates). Example:

dev

MakeLine

Reference GIS QuerySet API Reference

classMakeLine(geo_field,filter=None)[source] Availability: PostGIS, SpatiaLite Returns a LineString constructed from the point field geometries in the QuerySet. Currently, ordering the queryset has no effect. Example:

dev

Union

Reference GIS QuerySet API Reference

classUnion(geo_field,filter=None)[source] Availability: PostGIS, Oracle, SpatiaLite This method returns a GEOSGeometry object comprising the union of every geometry in the queryset. Please note that use of Union is processor intensive and may take a significant amount of time on large querysets.

dev

Extent

Reference GIS QuerySet API Reference Distance LookupsAggregate Functions

classExtent(geo_field,filter=None)[source] Availability: PostGIS, Oracle, SpatiaLite Returns the extent of all geo_field in the QuerySet as a 4-tuple, comprising the lower left coordinate and the upper right coordinate. Example:

4.2 5.0 5.1 5.2 6.0

Extent3D

Reference GIS QuerySet API Reference Distance LookupsAggregate Functions

classExtent3D(geo_field,filter=None)[source] Availability: PostGIS Returns the 3D extent of all geo_field in the QuerySet as a 6-tuple, comprising the lower left coordinate and upper right coordinate (each with x, y, and z coordinates). Example:

4.2 5.0 5.1 5.2 6.0

MakeLine

Reference GIS QuerySet API Reference Distance LookupsAggregate Functions

classMakeLine(geo_field,filter=None)[source] Availability: PostGIS, SpatiaLite Returns a LineString constructed from the point field geometries in the QuerySet. Currently, ordering the queryset has no effect. Example:

4.2 5.0 5.1 5.2 6.0

Union

Reference GIS QuerySet API Reference Distance LookupsAggregate Functions

classUnion(geo_field,filter=None)[source] Availability: PostGIS, Oracle, SpatiaLite This method returns a GEOSGeometry object comprising the union of every geometry in the queryset. Please note that use of Union is processor intensive and may take a significant amount of time on large querysets.

4.2 5.0 5.1 5.2 6.0

ModelAdmin methods

Reference The Django admin site

ModelAdmin.get_queryset(request) : The get_queryset method on a ModelAdmin returns a QuerySet of all model instances that can be edited by the admin site.

dev

Exists() subqueries

Reference Query Expressions

classExists(queryset)[source] Exists is a Subquery subclass that uses an SQL EXISTS statement. In many cases it will perform better than a subquery since the database is able to stop evaluation of the subquery when a first matching row is found.

dev