Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed #17152 -- Fixed a few anomalies in the contrib.formtools docu…
…mentation and templates. Thanks, Bradley Ayers.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17072 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jphalip committed Nov 6, 2011
1 parent b2948d8 commit 5f64af9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
@@ -1,5 +1,6 @@
{% load i18n %}
{% csrf_token %}
{{ wizard.form.media }}
{{ wizard.management_form }}
{% if wizard.form.forms %}
{{ wizard.form.management_form }}
Expand All @@ -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" %}" />
19 changes: 12 additions & 7 deletions docs/ref/contrib/formtools/form-wizard.txt
Expand Up @@ -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:

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

Expand Down

0 comments on commit 5f64af9

Please sign in to comment.