Browse Source

Fixed #17152 -- Fixed a few anomalies in the `contrib.formtools` documentation and templates. Thanks, Bradley Ayers.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17072 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Julien Phalip 13 years ago
parent
commit
5f64af9ecb

+ 3 - 2
django/contrib/formtools/templates/formtools/wizard/wizard_form.html

@@ -1,5 +1,6 @@
 {% load i18n %}
 {% csrf_token %}
+{{ wizard.form.media }}
 {{ wizard.management_form }}
 {% if wizard.form.forms %}
     {{ wizard.form.management_form }}
@@ -11,7 +12,7 @@
 {% endif %}
 
 {% if wizard.steps.prev %}
-<button name="wizard_prev_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
-<button name="wizard_prev_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
+<button name="wizard_prev_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
+<button name="wizard_prev_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
 {% endif %}
 <input type="submit" name="submit" value="{% trans "submit" %}" />

+ 12 - 7
docs/ref/contrib/formtools/form-wizard.txt

@@ -160,8 +160,9 @@ latter one allows you to use a different template for each form.
 This template expects a ``wizard`` object that has various items attached to
 it:
 
-* ``form`` -- The :class:`~django.forms.Form` instance for the current
-  step (either empty or with errors).
+* ``form`` -- The :class:`~django.forms.Form` or
+  :class:`~django.forms.formset.BaseFormSet` instance for the current step
+  (either empty or with errors).
 
 * ``steps`` -- A helper object to access the various steps related data:
 
@@ -186,9 +187,13 @@ Here's a full example template:
 
     {% extends "base.html" %}
 
+    {% block head %}
+    {{ wizard.form.media }}
+    {% endblock %}
+
     {% block content %}
     <p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p>
-    <form action="." method="post">{% csrf_token %}
+    <form action="" method="post">{% csrf_token %}
     <table>
     {{ wizard.management_form }}
     {% if wizard.form.forms %}
@@ -199,12 +204,12 @@ Here's a full example template:
     {% else %}
         {{ wizard.form }}
     {% endif %}
+    </table>
     {% if wizard.steps.prev %}
-    <button name="wizard_prev_step" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
-    <button name="wizard_prev_step" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
+    <button name="wizard_prev_step" type="submit" value="{{ wizard.steps.first }}">{% trans "first step" %}</button>
+    <button name="wizard_prev_step" type="submit" value="{{ wizard.steps.prev }}">{% trans "prev step" %}</button>
     {% endif %}
-    </table>
-    <input type="submit">
+    <input type="submit" value="{% trans "submit" %}"/>
     </form>
     {% endblock %}