From 33e8dcf4dcef167d15b480b24b50374dd57963ed Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Mon, 7 Feb 2011 00:57:33 -0400 Subject: [PATCH] Allow generic form template to handle multiple form on the same page --- apps/common/templates/generic_form.html | 23 ++++++++++++++++++- .../templates/generic_form_subtemplate.html | 11 ++++----- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/apps/common/templates/generic_form.html b/apps/common/templates/generic_form.html index 36c3c3ce47..f73567c4cb 100755 --- a/apps/common/templates/generic_form.html +++ b/apps/common/templates/generic_form.html @@ -2,7 +2,28 @@ {% block title %} :: {% with "true" as striptags %}{% include "calculate_form_title.html" %}{% endwith %}{% endblock %} {% block content %} - {% include "generic_form_subtemplate.html" %} + + {% if form %} + {% include "generic_form_subtemplate.html" %} + {% endif %} + + {% for form in form_list %} + {% with form.submit_method as submit_method %} + {% with form.striptags as striptags %} + {% with form.title as title %} + {% with form.object as object %} + {% with form.object_name as object_name %} + {% with form.form_action as form_action %} + {% with form.form as form %} + {% include "generic_form_subtemplate.html" %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endfor %} {% for subtemplate in subtemplates_dict %} {% with subtemplate.title as title %} diff --git a/apps/common/templates/generic_form_subtemplate.html b/apps/common/templates/generic_form_subtemplate.html index 81c43574e2..6d92098022 100755 --- a/apps/common/templates/generic_form_subtemplate.html +++ b/apps/common/templates/generic_form_subtemplate.html @@ -7,7 +7,7 @@

{% endif %} - + {% include "calculate_form_title.html" %} {% if side_bar %} @@ -18,11 +18,10 @@

{% endif %} - {% if form.is_multipart %} -
+ {% else %} - + {% endif %} {% if step_field %} @@ -64,10 +63,10 @@ {% else %} {% include "generic_form_instance.html" %} {% endif %} - + {% if not read_only %}