django template
I am overwriting an inline template - in my template I used:
{% for line in fieldset %}
{% for field in line %}
<td class="original {{ field.field.name }}">
<div name="foobar_a">
{% ifequal field.field.name "rule_type" %}
{% ifequal field.field "2"开发者_如何学编程 %}
fine
{% endifequal %}
{% endifequal %}
</div>
{{ field.field }} {% endfor %} {% endfor %} {% endfor %}
</tr>
{% endfor %}
But this doesn't work because the field.field
gives a HTML tag and the value of the field, i.e:
<input id="id_waprule_set-0-rule_type" type="hidden" value="2" name="waprule_set-0-rule_type"/>
2
Because of this my ifequal
is not working.
Is there any way that I can get the only value i.e '2' without using JavaScript?
Try field.field.value
(if field.field.name
is working, this should too).
精彩评论