Reputation: 3
Normally when I want to display individual form fields I use:
{{ form.NAMEOFFIELD }}
and if I want to display the entire form I just do:
{{ form }}
But now I'm working on a file where that doesn't work. The backend developers might not have made the form view specific so the only way I can display it is by doing:
{% render_comment_form for object.video %}
For this form, how can I grab individual field and catch form errors (since it's not called the usual way)?
Upvotes: 0
Views: 68
Reputation: 599610
Presumably you're talking about the comments app. As well as render_comment_form
, that app provides a get_comment_form
tag:
{% get_comment_form for object.video as comment_form %}
Now the form is available in the comment_form
variable, and can be iterated in the normal way.
Upvotes: 2