In this post, we will see how to create a textarea in a form in Django and with this, have a larger textarea to be able to write instead of a text type input in which we can only write texts on a single line , widely used to create comment albums or to write a description and like every field in HTML, it is perfectly customizable at the style level.
Textareas are common for things like entering comments or other extensive information.
How can we create a textarea in Django?
The following code below can be used to create a textarea in a Django form:
comment= forms.CharField(widget=forms.Textarea)
We can also customize the attributes, such as in this case the rows and columns:
comment= forms.CharField(widget=forms.Textarea(attrs={"rows":8, "cols":10})
In this example, we create a textarea with 8 rows and 10 columns.
Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter