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
This commit is contained in:
Julien Phalip 2011-11-06 01:19:40 +00:00
parent b2948d8179
commit 5f64af9ecb
2 changed files with 16 additions and 10 deletions

View File

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

View File

@ -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 %}
{% 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>
{% endif %}
</table>
<input type="submit">
{% if wizard.steps.prev %}
<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" value="{% trans "submit" %}"/>
</form>
{% endblock %}