djangodocs.org

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

Field

Reference GDAL API Vector Data Source Objects

classField : name

OGRGeomType

Reference GDAL API OGR Geometries

classOGRGeomType(type_input)[source] : This class allows for the representation of an OGR geometry type in any of several ways:

relate

Reference GIS QuerySet API Reference Spatial Lookups

This lookup requires a tuple parameter, (geom, pattern); the form of pattern will depend on the spatial backend:

Distance Lookups

Reference GIS QuerySet API Reference

Availability: PostGIS, Oracle, MariaDB, MySQL, SpatiaLite, PGRaster (Native) For an overview on performing distance queries, please refer to the distance queries introduction.

GeoDjango

Reference

… Data Geographic Models Importing Spatial Data Spatial Queries Putting your data on the map GeoDjango Installation Overview Requirements Installation Troubleshooting Platform-specific instructions GeoDjango Model API Spatial Field Types Spatial Field Options Geometry Field Options GeoDjango Database API Spatial Backends Creating …

IntegerRangeField

Reference PostgreSQL specific model fields Range Fields

classIntegerRangeField(**options) : Stores a range of integers. Based on an IntegerField. Represented by an int4range in the database and a django.db.backends.postgresql.psycopg_any.NumericRange in Python.

BigIntegerRangeField

Reference PostgreSQL specific model fields Range Fields

classBigIntegerRangeField(**options) : Stores a range of large integers. Based on a BigIntegerField. Represented by an int8range in the database and a django.db.backends.postgresql.psycopg_any.NumericRange in Python.

DateRangeField

Reference PostgreSQL specific model fields Range Fields

classDateRangeField(**options) : Stores a range of dates. Based on a DateField. Represented by a daterange in the database and a django.db.backends.postgresql.psycopg_any.DateRange in Python.

loaddata

Reference django-admin and manage.py Available commands

--format FORMAT Specifies the serialization format (e.g., json or xml) for fixtures read from stdin. --exclude EXCLUDE, -e EXCLUDE Excludes loading the fixtures from the given applications and/or models (in the form of app_label or app_label.ModelName).

Reference Widgets

In the following example, the years attribute is set for a SelectDateWidget: See the Built-in widgets for more information about which widgets are available and which arguments they accept.

Styling widget classes

Reference Widgets Customizing widget instances

In a nutshell, you will need to subclass the widget and either define a “Media” inner class or create a “media” property. These methods involve somewhat advanced Python programming and are described in detail in the Form Assets topic guide.

RadioSelect

Reference Widgets Built-in widgetsSelector and checkbox widgets

classRadioSelect[source] : - template_name: 'django/forms/widgets/radio.html' - option_template_name: 'django/forms/widgets/radio_option.html'

Query Expressions

Reference

There are a number of built-in expressions (documented below) that can be used to help you write queries. Expressions can be combined, or in some cases nested, to form more complex computations.

ImageField

Reference Model field reference Field types

As with other fields, you can change the maximum length using the max_length argument. The default form widget for this field is a ClearableFileInput.

prefetch_related()

Reference QuerySet API reference QuerySet APIMethods that return new QuerySets

This means that for a large QuerySet a large ‘IN’ clause could be generated, which, depending on the database, might have performance problems of its own when it comes to parsing or executing the SQL query.

QueryDict objects

Reference Request and response objects

This is necessary because some HTML form elements, notably <select multiple>, pass multiple values for the same key. The QueryDicts at request.POST and request.GET will be immutable when accessed in a normal request/response cycle.

CSRF_COOKIE_AGE

Reference Settings Core Settings

Without persistent cookies, the form submission would fail in this case.

CSRF_COOKIE_DOMAIN

Reference Settings Core 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.

CSRF_COOKIE_HTTPONLY

Reference Settings Core 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.