Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django模板从表单中排除字段_Python_Django_Django Forms_Django Templates_Django Bootstrap3 - Fatal编程技术网

Python Django模板从表单中排除字段

Python Django模板从表单中排除字段,python,django,django-forms,django-templates,django-bootstrap3,Python,Django,Django Forms,Django Templates,Django Bootstrap3,我正在使用django-bootstrap4。我想从表单中排除一个字段。如何使用bootstrap4实现这一点 我的观点: {% for item in form %} {% cycle 'row' '' as row silent %} {% if row %} <div class="row">{% endif %} <div class="col-md-6"> {

我正在使用django-bootstrap4。我想从表单中排除一个字段。如何使用
bootstrap4
实现这一点

我的观点:

{% 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 %}
{%表格%中的项目]
{%循环“行“””作为行静默%}
{%if行%}
{%endif%}
{%bootstrap_字段item exclude=item.insurated_type%}
{%如果不是行%}
{%endif%}
{%endfor%}
我阅读了文档和
bootstrap\u字段
have
exclude
参数,但我不知道如何使用它。我想
排除名为
投保类型的
字段

太简单了

{% bootstrap_field item exclude="insured_type" form_group_class="col-md-6 form-group" %}

django的方法是在模板中使用最小的逻辑。我认为创建一个只包含所需字段的表单可能会更好