How to Create a Text area in a Django Form 


               


How to Create a Text area in a Django Form



Python


In this article, we show how to create a text area in a Django form.

A text area is provides a much larger area for data entry than a text field.

Text areas are common for things such as entering comments or other large pieces of information.

So how can we create a text area in Django.

The following code below can be used to create a text area in a Django form.



So this line in a form will create a text area with the label, Comment.

There's more that we can do, however.

Say you want the text area to be a certain width or height. You can do this by adding attributes to the text area.

This is shown below.



So now the text area will be sized with having 5 rows and 20 columns.

Of course text areas can be resized in web browsers. However, this specifies the default value that the text area should be when the page loads, without the user making any adjustments.

So this is was just a quick showing on how to create and size text areas in Django forms.


Related Resources

How to Randomly Select From or Shuffle a List in Python



HTML Comment Box is loading comments...