[英]How can I show only some options using django and select?
Hello I have this code using Django in a HTML file : 您好我在HTML文件中使用Django的代码:
<select class="form-control" data-formsource="test" id="id_test1" name="type">
{% for x,y in opt %}
<option value="{{ y }}" data-select="{{ y }}">{% trans y %}</option>
{% endfor %}
</select>
And there is an option which is "available" but I don't want to see this option ... How can I do this ? 并且有一个“可用”的选项,但我不想看到这个选项......我怎么能这样做?
Thank you very much ! 非常感谢你 !
<select class="form-control" data-formsource="test" id="id_test1" name="type">
{% for x,y in opt %}
{% if x != 'available' %}
<option value="{{ y }}" data-select="{{ y }}">{% trans y %}</option>
{% endif %}
{% endfor %}
</select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.