Form Field Widgets and Labels
Django form widgets will be discussed in this lesson.
How to customize widgets
A widget in Django is the HTML representation of a form field. By default, each Django form field works with a specific type of widget. For example, when we selected the integer field, we render an integer widget.
Widgets should not be confused with fields, as fields represent the input validation logic, whereas widgets represent the HTML rendering of the fields.
We can customize these widgets right inside of the form. In this lesson, we will discuss some of these widgets to get a basic idea of how they work. Let’s discuss them one by one and learn about their syntax.
Textarea
widget
The following will provide us with a textarea
widget:
text = forms.CharField(min_length=7,widget=forms.Textarea)
...