[Answered ]-Django Forms (Displaying labels)

2👍

Yes – when you use your form in your template, you can interact with the fields individually by accessing form.fieldname – like so:

<p>How would you rate the content of this site?</p>
Poor
{{ form.rating }}
Excellent

If you want to position a form field’s label and field differently, you can do that too:

{{ form.fieldname.label }}: {{ form.fieldname }}

And when it comes to displaying labels without a form there, you should be able to just add them to your markup yourself – you don’t need Django for that.

Leave a comment