LibraryActive

Django ORM Database Functions

Classes letting users use underlying database functions as annotations, aggregations, or filters in Django.

Open source page

Product features

Product features

Built-in template context processors ¶

Built-in variables ¶

Cast

Forces the result type of expression to the one from output_field.

Coalesce

Accepts a list of at least two field names or expressions and returns the first non-null value.

Collate

Takes an expression and a collation name to query against.

Configuring an engine ¶

Extract

Extracts a component from a date or time field.

Greatest

Accepts a list of at least two field names or expressions and returns the greatest value.

How invalid variables are handled ¶

Least

Returns the least value from a list of expressions.

Limitations with string literals ¶

Loading a template ¶

NullIf

Returns null if two expressions are equal, otherwise returns the first expression.

Overview ¶

Playing with Context objects ¶

Rendering a context ¶

The Django template language: for Python programmers ¶

Trunc

Truncates a date or time field to a specified precision.

Using RequestContext ¶

Variables and lookups ¶