djangodocs.org

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

FilePathField

Reference Form fields

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

dev

ModelChoiceField

Reference Form fields

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

dev

NullBooleanSelect

Reference Widgets

classNullBooleanSelect[source] : - template_name: 'django/forms/widgets/select.html' - option_template_name: 'django/forms/widgets/select_option.html'

dev

SelectMultiple

Reference Widgets

classSelectMultiple[source] : - template_name: 'django/forms/widgets/select.html' - option_template_name: 'django/forms/widgets/select_option.html'

dev

CheckboxSelectMultiple

Reference Widgets

classCheckboxSelectMultiple[source] : - template_name: 'django/forms/widgets/checkbox_select.html' - option_template_name: 'django/forms/widgets/checkbox_option.html' Like RadioSelect, you can loop over the individual checkboxes for the widget’s choices.

dev

contains

Reference QuerySet API reference

Case-sensitive containment test. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) Note this will match the headline 'Lennon honored today' but not 'lennon honored today'.

dev

icontains

Reference QuerySet API reference

Case-insensitive containment test. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

dev

startswith

Reference QuerySet API reference

Case-sensitive starts-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) SQLite doesn’t support case-sensitive LIKE statements; startswith acts like istartswith for SQLite.

dev

istartswith

Reference QuerySet API reference

Case-insensitive starts-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

dev

endswith

Reference QuerySet API reference

Case-sensitive ends-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: SQLite doesn’t support case-sensitive LIKE statements; endswith > acts like iendswith for SQLite. Refer to the database note documentation for more.

dev

iendswith

Reference QuerySet API reference

Case-insensitive ends-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

dev

USE_BLANK_CHOICE_DASH

Reference Settings

NOTE: Added in version 6.1. Default: False The default blank choice label in Select widgets was changed from "---------" to django.db.models.fields.BLANK_CHOICE_LABEL. Set this transitional setting to True to revert to the previous label.

dev

Deferring model fields

Topic guide Performing raw SQL 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.

dev

can_delete

Topic guide Formsets

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.

dev

contains

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive containment test. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) Note this will match the headline 'Lennon honored today' but not 'lennon honored today'.

4.2 5.0 5.1 5.2 6.0

icontains

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive containment test. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

4.2 5.0 5.1 5.2 6.0

startswith

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive starts-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) SQLite doesn’t support case-sensitive LIKE statements; startswith acts like istartswith for SQLite.

4.2 5.0 5.1 5.2 6.0

istartswith

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive starts-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

4.2 5.0 5.1 5.2 6.0

endswith

Reference QuerySet API reference QuerySet APIField lookups

Case-sensitive ends-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: SQLite doesn’t support case-sensitive LIKE statements; endswith > acts like iendswith for SQLite. Refer to the database note documentation for more.

4.2 5.0 5.1 5.2 6.0

iendswith

Reference QuerySet API reference QuerySet APIField lookups

Case-insensitive ends-with. Example: SQL equivalent: (The exact SQL syntax varies for each database engine.) NOTE: When using the SQLite backend and non-ASCII strings, bear in mind the > database note about string comparisons.

4.2 5.0 5.1 5.2 6.0