djangodocs.org

711 sections in Django dev Search all versions →

Widget classes

Reference GeoDjango Forms API

OpenLayersWidget classOpenLayersWidget[source] : This is the default widget used by all GeoDjango form fields. Attributes are: OSMWidget classOSMWidget[source] : This widget specialized OpenLayersWidget and uses an OpenStreetMap base layer to display geographic objects on. Attributes are:

OGRGeomType

Reference GDAL API

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

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

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

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

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

--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).

Attributes of BoundField

Reference The Forms API

Returns None if aria-describedby is set in Widget.attrs to preserve the user defined attribute when rendering the form. BoundField.auto_id[source] : The HTML ID attribute for this BoundField. Returns an empty string if Form.auto_id is False.

Attributes of BoundField

Reference The Forms API

BoundField.initial[source] : Use BoundField.initial to retrieve initial data for a form field. It retrieves the data from Form.initial if present, otherwise trying Field.initial. Callable values are evaluated. See Initial form values for more examples.

modelformset_factory

Reference Model forms

modelformset_factory(model,form=ModelForm,formfield_callback=None,formset=BaseModelFormSet,extra=1,can_delete=False,can_order=False,max_num=None,fields=None,exclude=None,widgets=None,validate_max=False,localized_fields=None,labels=None,help_texts=None,error_messages=None,min_num=None,validate_min=False,field_classes=None,absolute_max=None,can_delete_extra=True,renderer=None,edit_only=False)[source] : Returns a FormSet class for the given model class.

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

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.

Select

Reference Widgets

classSelect[source] : - template_name: 'django/forms/widgets/select.html' - option_template_name: 'django/forms/widgets/select_option.html' - Renders as: <select><option ...>...</select>

RadioSelect

Reference 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

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.