Allow generic form template to handle multiple form on the same page

This commit is contained in:
Roberto Rosario
2011-02-07 00:57:33 -04:00
parent 7da543f7d3
commit 33e8dcf4dc
2 changed files with 27 additions and 7 deletions

View File

@@ -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 %}

View File

@@ -7,7 +7,7 @@
<div class="content">
<h2 class="title">
{% endif %}
{% include "calculate_form_title.html" %}
{% if side_bar %}
@@ -18,11 +18,10 @@
</h2>
<div class="inner">
{% endif %}
{% if form.is_multipart %}
<form enctype="multipart/form-data" method="{{ submit_method|default:'post' }}" action="" class="form">
<form name="{{ form.prefix }}" enctype="multipart/form-data" method="{{ submit_method|default:'post' }}" action="{{ form_action }}" class="form">
{% else %}
<form method="{{ submit_method|default:'post' }}" action="" class="form">
<form name="{{ form.prefix }}" method="{{ submit_method|default:'post' }}" action="{{ form_action }}" class="form">
{% endif %}
{% if step_field %}
<input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />
@@ -64,10 +63,10 @@
{% else %}
{% include "generic_form_instance.html" %}
{% endif %}
{% if not read_only %}
<div class="group navform wat-cf">
<button class="button" type="submit">
<button class="button" type="submit" name="{{ form.prefix }}-submit">
<img src="{{ MEDIA_URL }}web_theme_media/images/icons/tick.png" alt="{% if object %}{% trans 'Save' %}{% else %}{% trans 'Submit' %}{% endif %}" /> {% if object %}{% trans 'Save' %}{% else %}{% trans 'Submit' %}{% endif %}
</button>
{% comment %}