I have a Django form that contains several fields I am looping through. I want to branch the code if the field is the "comment" field, something like this:
{% for field in form.visible_fields %}
{% if field == form.fields.comment %}
<do something>
{% else %}
<do something else>
{% endif %}
{% endfor %}
What i开发者_运维知识库s the correct syntax for the 2nd line? The current line always fails.
I believe it would be:
{% if field.field == form.fields.comment %}
精彩评论