Reference
Form fields
Built-in Field classes
classFilePathField(**kwargs)[source] : - Default widget: Select - Empty value: '' (an empty string) - Normalizes to: A string. - Validates that the selected choice exists in the list of choices. - Error message keys: required, invalid_choice
Reference
Form fields
Fields which handle relationships
classModelChoiceField(**kwargs)[source] : - Default widget: Select - Empty value: None - Normalizes to: A model instance. - Validates that the given id exists in the queryset. - Error message keys: required, invalid_choice
Reference
Widgets
Built-in widgetsSelector and checkbox widgets
classNullBooleanSelect[source] : - template_name: 'django/forms/widgets/select.html' - option_template_name: 'django/forms/widgets/select_option.html'
Reference
Widgets
Built-in widgetsSelector and checkbox widgets
classSelectMultiple[source] : - template_name: 'django/forms/widgets/select.html' - option_template_name: 'django/forms/widgets/select_option.html'
Reference
Widgets
Built-in widgetsComposite widgets
classSelectDateWidget[source] : - template_name: 'django/forms/widgets/select_date.html'
Reference
QuerySet API reference
QuerySet APIField lookups
Case-sensitive containment test. Example: SQL equivalent: Note this will match the headline 'Lennon honored today' but not 'lennon honored today'. NOTE: SQLite doesn’t support case-sensitive LIKE statements; contains > acts like icontains for SQLite.
Reference
QuerySet API reference
QuerySet APIField lookups
Case-insensitive containment test. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.
Reference
QuerySet API reference
QuerySet APIField lookups
Case-sensitive starts-with. Example: SQL equivalent: SQLite doesn’t support case-sensitive LIKE statements; startswith acts like istartswith for SQLite.
Reference
QuerySet API reference
QuerySet APIField lookups
Case-insensitive starts-with. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.
Reference
QuerySet API reference
QuerySet APIField lookups
Case-sensitive ends-with. Example: SQL equivalent: NOTE: SQLite doesn’t support case-sensitive LIKE statements; endswith > acts like iendswith for SQLite. Refer to the database note documentation for more.
Reference
QuerySet API reference
QuerySet APIField lookups
Case-insensitive ends-with. Example: SQL equivalent: NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.
Topic guide
Performing raw SQL queries
Performing raw queries
Fields may also be left out: The Person objects returned by this query will be deferred model instances (see defer()). This means that the fields that are omitted from the query will be loaded on demand.
Topic guide
Formsets
Dealing with ordering and deletion of forms
BaseFormSet.can_delete Default: False Lets you create a formset with the ability to select forms for deletion: Similar to can_order this adds a new field to each form named DELETE and is a forms.BooleanField.
FAQ
FAQ: Databases and models
Make sure your Django DEBUG setting is set to True. Then do this: connection.queries is only available if DEBUG is True. It’s a list of dictionaries in order of query execution.
Internals
Organization of the Django Project
Steering council
The steering council is a group of experienced contributors who: provide oversight of Django’s development and release process, assist in setting the direction of feature development and releases, select Mergers and Releasers, and have a tie-breaking vote when other decision-making …
Reference
The basic workflow of Django’s admin is, in a nutshell, “select an object, then change it.” This works well for a majority of use cases.
Reference
GIS QuerySet API Reference
Spatial Lookups
Availability: PostGIS, PGRaster (Conversion) Tests if the geometry field’s bounding box is strictly to the left of the lookup geometry’s bounding box. Example: PostGIS equivalent:
Reference
GIS QuerySet API Reference
Spatial Lookups
Availability: PostGIS, PGRaster (Conversion) Tests if the geometry field’s bounding box is strictly to the right of the lookup geometry’s bounding box. Example: PostGIS equivalent:
Reference
GIS QuerySet API Reference
Spatial Lookups
Availability: PostGIS, PGRaster (Bilateral) Tests if the geometry field’s bounding box overlaps or is to the left of the lookup geometry’s bounding box. Example: PostGIS equivalent:
Reference
GIS QuerySet API Reference
Spatial Lookups
Availability: PostGIS, PGRaster (Bilateral) Tests if the geometry field’s bounding box overlaps or is to the right of the lookup geometry’s bounding box. Example: PostGIS equivalent: