djangodocs.org

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

1.10

Internals Django Deprecation Timeline

The following private APIs will be removed from django.db.models.options.Options (Model._meta): get_field_by_name() get_all_field_names() get_fields_with_model() get_concrete_fields_with_model() get_m2m_with_model() get_all_related_objects() get_all_related_objects_with_model() get_all_related_many_to_many_objects() get_all_related_m2m_objects_with_model() The error_message argument of django.forms.RegexField will be removed. The unordered_list filter will no longer support old style lists.

4.2

T

Index

… - teardown_databases() (DiscoverRunner method) - (in module django.test.utils) - teardown_test_environment() (DiscoverRunner method) - (in module django.test.utils) - TelInput (class in django.forms) - tell() (HttpResponse method) - template - (Aggregate attribute) - Template (class in django.template) - template (Func attribute) - …

Core field arguments

Reference Form fields

Each Field class constructor takes at least these arguments. Some Field classes take additional, field-specific arguments, but the following should always be accepted:

dev

widget

Reference Form fields Core field arguments

Field.widget The widget argument lets you specify a Widget class to use when rendering this Field. See Widgets for more information.

template_name

Reference Form fields

By default this value is set to "django/forms/field.html". Can be changed per field by overriding this attribute or more generally by overriding the default template, see also Overriding built-in field templates.

dev

DateField

Reference Form fields

- Validates that the given value is either a datetime.date, datetime.datetime or string formatted in a particular date format. - Error message keys: required, invalid

dev

DateTimeField

Reference Form fields

- Validates that the given value is either a datetime.datetime, datetime.date or string formatted in a particular datetime format. - Error message keys: required, invalid

dev

DurationField

Reference Form fields

classDurationField(**kwargs)[source] : - Default widget: TextInput - Empty value: None - Normalizes to: A Python timedelta. - Validates that the given value is a string which can be converted into a timedelta. The value must be between datetime.timedelta.min and datetime.timedelta.max.

dev

MultipleChoiceField

Reference Form fields

classMultipleChoiceField(**kwargs)[source] : - Default widget: SelectMultiple - Empty value: [] (an empty list) - Normalizes to: A list of strings. - Validates that every value in the given list of values exists in the list of choices.

dev

TimeField

Reference Form fields

- Validates that the given value is either a datetime.time or string formatted in a particular time format. - Error message keys: required, invalid

dev

TypedMultipleChoiceField

Reference Form fields

classTypedMultipleChoiceField(**kwargs)[source] : Just like a MultipleChoiceField, except TypedMultipleChoiceField takes two extra arguments, coerce and empty_value.

dev

UUIDField

Reference Form fields

classUUIDField(**kwargs)[source] : - Default widget: TextInput - Empty value: None - Normalizes to: A UUID object. - Error message keys: required, invalid

dev

SplitDateTimeField

Reference Form fields

- Validates that the given value is a datetime.datetime or string formatted in a particular datetime format. - Error message keys: required, invalid, invalid_date, invalid_time

dev

ModelMultipleChoiceField

Reference Form fields

classModelMultipleChoiceField(**kwargs)[source] : - Default widget: SelectMultiple - Empty value: An empty QuerySet (self.queryset.none()) - Normalizes to: A QuerySet of model instances. - Validates that every id in the given list of values exists in the queryset.

dev

Reference Form fields

By default, ModelChoiceField and ModelMultipleChoiceField use ModelChoiceIterator to generate their field choices. When iterated, ModelChoiceIterator yields 2-tuple choices containing ModelChoiceIteratorValue instances as the first value element in each choice.

dev

ModelChoiceIterator

Reference Form fields

classModelChoiceIterator(field)[source] : The default class assigned to the iterator attribute of ModelChoiceField and ModelMultipleChoiceField. An iterable that yields 2-tuple choices from the queryset.

dev