小编dj *_*pro的帖子

模板中没有命名周期.'row1,row2'未定义

在我的django内联formset中,表单html:

{% block body %}        
    <h2>Profile</h2>
    <hr>
    <div class="col-md-4">
        <form action="" method="post">{% csrf_token %}
            {{ form.as_p }}

            <table class="table">
                {{ familymembers.management_form }}

                {% for form in familymembers.forms %}
                    {% if forloop.first %}
                        <thead>
                        <tr>
                            {% for field in form.visible_fields %}
                                <th>{{ field.label|capfirst }}</th>
                            {% endfor %}
                        </tr>
                        </thead>
                    {% endif %}
                    <tr class="{% cycle row1,row2 %} formset_row">
                        {% for field in form.visible_fields %}
                            <td>
                                {# Include the hidden fields in the form #}
                                {% if forloop.first %}
                                    {% for hidden …
Run Code Online (Sandbox Code Playgroud)

django templates

3
推荐指数
1
解决办法
1538
查看次数

标签 统计

django ×1

templates ×1