From 4326a2fbb632492d0ec43307fd6470af610078d9 Mon Sep 17 00:00:00 2001 From: arjoonn sharma Date: Fri, 6 Mar 2015 11:36:06 +0530 Subject: [PATCH] In the form.html template cehcking the same condition is done twice. Doing it once reduces complexity making the code faster while rendering. Also since the check is done on a high level like templates, it is slower than the native python if condition. Thus the need to reduce checks on the higher levels. --- bootstrapform/templates/bootstrapform/formset.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/bootstrapform/templates/bootstrapform/formset.html b/bootstrapform/templates/bootstrapform/formset.html index 476b6ca..a2efdc8 100644 --- a/bootstrapform/templates/bootstrapform/formset.html +++ b/bootstrapform/templates/bootstrapform/formset.html @@ -1,15 +1,11 @@ {{ formset.management_form }} {% for form in formset %} - {% if classes.label == 'sr-only' %}
+ {% include "bootstrapform/form.html" with form=form %} +
+ {%else%} + {% include "bootstrapform/form.html" with form=form %} {% endif %} - - {% include "bootstrapform/form.html" with form=form %} - - {% if classes.label == 'sr-only' %} - - {% endif %} - {% endfor %}