Django forms adding <div> after form field
django, django-forms, django-templates, html, python
Solution
Dont render the form by using `form.as_p`. You need to show each field of the form, for example, by using `form.to`. By using this way, you can wrap the field 'to' into a div
<div>{{ form.To}} </div>
For more detail, view this link
Problem
Below is my form code : ``` class FMessage(forms.Form): From = forms.CharField() To = forms.CharField() Subject = forms.CharField() Message = forms.CharField() ``` and this is my html code: ``` <form method='POST' action='.'> {% csrf_token %} {{ form.as_p }} <input type='submit' value='submit'> </form> ``` The code works fine by displaying forms and has not any issue in functionality, but now I need to wrap my form fields in html by a `div` like this: ``` <div id='mydiv'> <input ... /> <div> ``` How can I fix it?