Reference
The form rendering API
Built-in widget templates are stored in the django/forms/widgets path. You can provide a custom template for input.html by defining django/forms/templates/django/forms/widgets/input.html, for example. See Built-in widgets for the name of each widget’s template.
dev
Reference
The form rendering API
Formset templates receive a context from BaseFormSet.get_context(). By default, formsets receive a dictionary with the following values: formset: The formset instance.
4.2
5.0
5.1
5.2
6.0
Reference
The form rendering API
Field templates receive a context from BoundField.get_context(). By default, fields receive a dictionary with the following values: field: The BoundField.
5.0
5.1
5.2
6.0
Reference
The form rendering API
This is a dictionary that contains values like: name value attrs is_hidden template_name Some widgets add further information to the context. For instance, all widgets that subclass Input defines widget['type'] and MultiWidget defines widget['subwidgets'] for looping purposes.
4.2
5.0
5.1
5.2
6.0
Reference
The form rendering API
BaseFormSet.template_name To override formset templates, you must use the TemplatesSetting renderer. Then overriding formset templates works the same as overriding any other template in your project.
4.2
5.0
5.1
5.2
6.0
Reference
The form rendering API
Field.template_name To override field templates, you must use the TemplatesSetting renderer. Then overriding field templates works the same as overriding any other template in your project.
4.2
5.0
5.1
5.2
6.0
Reference
The form rendering API
Built-in widget templates are stored in the django/forms/widgets path. You can provide a custom template for input.html by defining django/forms/widgets/input.html, for example. See Built-in widgets for the name of each widget’s template.
5.0
5.1
5.2
6.0
Reference
Model forms
Model form factory functions
inlineformset_factory(parent_model,model,form=ModelForm,formset=BaseInlineFormSet,fk_name=None,fields=None,exclude=None,extra=3,can_order=False,can_delete=True,max_num=None,formfield_callback=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 an InlineFormSet using modelformset_factory() with defaults of formset=BaseInlineFormSet, can_delete=True, and extra=3.
4.2
5.0
5.1
5.2
6.0
Reference
PostgreSQL specific form fields and widgets
dev
Reference
PostgreSQL specific form fields and widgets
This group of fields all share similar functionality for accepting range data. They are based on MultiValueField. They treat one omitted value as an unbounded range. They also validate that the lower bound is not greater than the upper bound.
dev
Reference
PostgreSQL specific form fields and widgets
classIntegerRangeField : Based on IntegerField and translates its input into django.db.backends.postgresql.psycopg_any.NumericRange. Default for IntegerRangeField and BigIntegerRangeField.
dev
Reference
PostgreSQL specific form fields and widgets
classDecimalRangeField : Based on DecimalField and translates its input into django.db.backends.postgresql.psycopg_any.NumericRange. Default for DecimalRangeField.
dev
Reference
PostgreSQL specific form fields and widgets
classDateTimeRangeField : Based on DateTimeField and translates its input into django.db.backends.postgresql.psycopg_any.DateTimeTZRange. Default for DateTimeRangeField.
dev
Reference
PostgreSQL specific form fields and widgets
classDateRangeField : Based on DateField and translates its input into django.db.backends.postgresql.psycopg_any.DateRange. Default for DateRangeField.
dev
Reference
PostgreSQL specific form fields and widgets
dev
Reference
PostgreSQL specific form fields and widgets
classRangeWidget(base_widget,attrs=None) : Widget used by all of the range fields. Based on MultiWidget.
dev
Reference
PostgreSQL specific form fields and widgets
4.2
5.0
5.1
5.2
6.0
Reference
PostgreSQL specific form fields and widgets
Fields
This group of fields all share similar functionality for accepting range data. They are based on MultiValueField. They treat one omitted value as an unbounded range. They also validate that the lower bound is not greater than the upper bound.
4.2
5.0
5.1
5.2
6.0
Reference
PostgreSQL specific form fields and widgets
FieldsRange Fields
classIntegerRangeField : Based on IntegerField and translates its input into django.db.backends.postgresql.psycopg_any.NumericRange. Default for IntegerRangeField and BigIntegerRangeField.
4.2
5.0
5.1
5.2
6.0
Reference
PostgreSQL specific form fields and widgets
FieldsRange Fields
classDecimalRangeField : Based on DecimalField and translates its input into django.db.backends.postgresql.psycopg_any.NumericRange. Default for DecimalRangeField.
4.2
5.0
5.1
5.2
6.0