开发者

django template

开发者 https://www.devze.com 2022-12-15 23:29 出处:网络
I am overwriting an inline template - inmy template I used: {% for line in fieldset %} {% for field in line %}

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消