djangodocs.org

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

CSRF_COOKIE_DOMAIN

Reference Settings

It should be set to a string such as ".example.com" to allow a POST request from a form on one subdomain to be accepted by a view served from another subdomain.

dev

CSRF_COOKIE_HTTPONLY

Reference Settings

If you enable this and need to send the value of the CSRF token with an AJAX request, your JavaScript must pull the value from a hidden CSRF token form input instead of from the cookie.

dev

Reference Settings

You can set this to None to disable the check. Applications that are expected to receive unusually large form posts should tune this setting. Under ASGI, the entire request may be spooled to disk before this limit is enforced.

dev

Reference Settings

You can set this to None to disable the check. Applications that are expected to receive an unusually large number of form fields should tune this setting.

dev

csp_nonce_attr

Reference Built-in template tags and filters

… object as the argument, renders its assets with the CSP nonce applied to each <script> and <link> element: In both forms, if the context processor is not configured, assets are rendered without a nonce attribute. See Nonce usage for full …

dev

get_static_prefix

Reference Built-in template tags and filters

… need more control over exactly where and how STATIC_URL is injected into the template, you can use the get_static_prefix template tag: There’s also a second form you can use to avoid extra processing if you need the value multiple times:

dev

Conversion functions

Reference Unicode data

… its input to a string. The encoding parameter specifies the input encoding. (For example, Django uses this internally when processing form input data, which might not be UTF-8 encoded.) The strings_only parameter, if set to True, will result in Python …

dev

Class-based views

Topic guide

For full details, see the class-based views reference documentation. Introduction to class-based views Built-in class-based generic views Form handling with class-based views Using mixins with class-based views NOTE: Django has a vibrant ecosystem.

dev

Topic guide Models

… you are using an intermediate model, you can also query on its attributes: If you need to access a membership’s information you may do so by directly querying the Membership model: Another way to access the same information is by …

dev

Field lookups

Topic guide Making queries

Field lookups are how you specify the meat of an SQL WHERE clause. They’re specified as keyword arguments to the QuerySet methods filter(), exclude() and get(). Basic lookups keyword arguments take the form field__lookuptype=value. (That’s a double-underscore).

dev

The pk lookup shortcut

Topic guide Making queries

… equivalent: The use of pk isn’t limited to __exact queries – any query term can be combined with pk to perform a query on the primary key of a model: pk lookups also work across joins. For example, these three …

dev

Topic guide Making queries

… To query a key for JSON null, None or JSONNull() can be used. Multiple keys can be chained together to form a path lookup: If the key is an integer, it will be interpreted as an index transform in an …

dev