[Answer]-Add unique styling to one form in a Django formset

1👍

See forloop.last in documentation

<form action="" method="post">{% csrf_token %}
    {{ formset.management_form }}
    {{ formset.non_form_errors }}
    <div>
    {% for form in formset %}
        {% if forloop.last %}
            {% for field in form %}
                {{ field.errors }}
                <div class="different style">
                    {{ field.label_tag }}: 
                    <p class="another different style">{{ field }}</p>
                </div>
            {% endfor %}
        {% else %}
            {% for field in form %}
                {{ field.errors }}
                {{ field.label_tag }}: {{ field }}
            {% endfor %}
        {% endif %}
    </div>
    <p><input type="submit" value="Submit" /></p>
</form>

Leave a comment