[英]Django templates exclude field from form
I'm working with django-bootstrap4
. 我正在使用
django-bootstrap4
。 I want to exclude one field from form. 我想从表单中排除一个字段。 How can I do that with
bootstrap4
. 我如何用
bootstrap4
做到这一点。
my view: 我的观点:
{% for item in form %}
{% cycle 'row' '' as row silent %}
{% if row %}
<div class="row">{% endif %}
<div class="col-md-6">
{% bootstrap_field item exclude=item.insured_type %}
</div>
{% if not row %}
</div>
{% endif %}
{% endfor %}
I read the documentation and bootstrap_field
have exclude
parameter but I have no idea how to use that. 我阅读了文档,
bootstrap_field
具有exclude
参数,但是我不知道如何使用它。 I wanted to exclude
field that name insured_type
. 我想
exclude
名称为insured_type
字段。
很简单。
{% bootstrap_field item exclude="insured_type" form_group_class="col-md-6 form-group" %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.