diff --git a/django/contrib/formtools/tests/wizard/__init__.py b/django/contrib/formtools/tests/wizard/__init__.py
index dce2fed..85d2b73 100644
a
|
b
|
from django.contrib.formtools.tests.wizard.loadstorage import TestLoadStorage
|
4 | 4 | from django.contrib.formtools.tests.wizard.namedwizardtests.tests import ( |
5 | 5 | NamedSessionWizardTests, |
6 | 6 | NamedCookieWizardTests, |
7 | | TestNamedUrlSessionFormWizard, |
8 | | TestNamedUrlCookieFormWizard, |
| 7 | TestNamedUrlSessionWizardView, |
| 8 | TestNamedUrlCookieWizardView, |
9 | 9 | NamedSessionFormTests, |
10 | 10 | NamedCookieFormTests, |
11 | 11 | ) |
diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py b/django/contrib/formtools/tests/wizard/namedwizardtests/tests.py
index 0f63882..3870dea 100644
a
|
b
|
class NamedFormTests(object):
|
319 | 319 | instance.render_done(None) |
320 | 320 | self.assertEqual(instance.storage.current_step, 'start') |
321 | 321 | |
322 | | class TestNamedUrlSessionFormWizard(NamedUrlSessionWizardView): |
| 322 | class TestNamedUrlSessionWizardView(NamedUrlSessionWizardView): |
323 | 323 | |
324 | 324 | def dispatch(self, request, *args, **kwargs): |
325 | | response = super(TestNamedUrlSessionFormWizard, self).dispatch(request, *args, **kwargs) |
| 325 | response = super(TestNamedUrlSessionWizardView, self).dispatch(request, *args, **kwargs) |
326 | 326 | return response, self |
327 | 327 | |
328 | | class TestNamedUrlCookieFormWizard(NamedUrlCookieWizardView): |
| 328 | class TestNamedUrlCookieWizardView(NamedUrlCookieWizardView): |
329 | 329 | |
330 | 330 | def dispatch(self, request, *args, **kwargs): |
331 | | response = super(TestNamedUrlCookieFormWizard, self).dispatch(request, *args, **kwargs) |
| 331 | response = super(TestNamedUrlCookieWizardView, self).dispatch(request, *args, **kwargs) |
332 | 332 | return response, self |
333 | 333 | |
334 | 334 | |
335 | 335 | class NamedSessionFormTests(NamedFormTests, TestCase): |
336 | | formwizard_class = TestNamedUrlSessionFormWizard |
| 336 | formwizard_class = TestNamedUrlSessionWizardView |
337 | 337 | wizard_urlname = 'nwiz_session' |
338 | 338 | |
339 | 339 | |
340 | 340 | class NamedCookieFormTests(NamedFormTests, TestCase): |
341 | | formwizard_class = TestNamedUrlCookieFormWizard |
| 341 | formwizard_class = TestNamedUrlCookieWizardView |
342 | 342 | wizard_urlname = 'nwiz_cookie' |
diff --git a/django/contrib/formtools/wizard/storage/cookie.py b/django/contrib/formtools/wizard/storage/cookie.py
index af26e01..d1776de 100644
a
|
b
|
class CookieStorage(storage.BaseStorage):
|
20 | 20 | except KeyError: |
21 | 21 | data = None |
22 | 22 | except BadSignature: |
23 | | raise SuspiciousOperation('FormWizard cookie manipulated') |
| 23 | raise SuspiciousOperation('WizardView cookie manipulated') |
24 | 24 | if data is None: |
25 | 25 | return None |
26 | 26 | return json.loads(data, cls=json.JSONDecoder) |
diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py
index 15ba146..badb2bf 100644
a
|
b
|
class WizardView(TemplateView):
|
102 | 102 | @classonlymethod |
103 | 103 | def as_view(cls, *args, **kwargs): |
104 | 104 | """ |
105 | | This method is used within urls.py to create unique formwizard |
| 105 | This method is used within urls.py to create unique wizardview |
106 | 106 | instances for every request. We need to override this method because |
107 | | we add some kwargs which are needed to make the formwizard usable. |
| 107 | we add some kwargs which are needed to make the wizardview usable. |
108 | 108 | """ |
109 | 109 | initkwargs = cls.get_initkwargs(*args, **kwargs) |
110 | 110 | return super(WizardView, cls).as_view(**initkwargs) |
… |
… |
class WizardView(TemplateView):
|
117 | 117 | |
118 | 118 | * `form_list` - is a list of forms. The list entries can be single form |
119 | 119 | classes or tuples of (`step_name`, `form_class`). If you pass a list |
120 | | of forms, the formwizard will convert the class list to |
| 120 | of forms, the wizardview will convert the class list to |
121 | 121 | (`zero_based_counter`, `form_class`). This is needed to access the |
122 | 122 | form for a specific step. |
123 | 123 | * `initial_dict` - contains a dictionary of initial data dictionaries. |
… |
… |
class WizardView(TemplateView):
|
130 | 130 | apply. |
131 | 131 | * `condition_dict` - contains a dictionary of boolean values or |
132 | 132 | callables. If the value of for a specific `step_name` is callable it |
133 | | will be called with the formwizard instance as the only argument. |
| 133 | will be called with the wizardview instance as the only argument. |
134 | 134 | If the return value is true, the step's form will be used. |
135 | 135 | """ |
136 | 136 | kwargs.update({ |
… |
… |
class WizardView(TemplateView):
|
159 | 159 | # we need to override the form variable. |
160 | 160 | form = form.form |
161 | 161 | # check if any form contains a FileField, if yes, we need a |
162 | | # file_storage added to the formwizard (by subclassing). |
| 162 | # file_storage added to the wizardview (by subclassing). |
163 | 163 | for field in form.base_fields.itervalues(): |
164 | 164 | if (isinstance(field, forms.FileField) and |
165 | 165 | not hasattr(cls, 'file_storage')): |
166 | 166 | raise NoFileStorageConfigured |
167 | 167 | |
168 | | # build the kwargs for the formwizard instances |
| 168 | # build the kwargs for the wizardview instances |
169 | 169 | kwargs['form_list'] = init_form_list |
170 | 170 | return kwargs |
171 | 171 | |
… |
… |
class WizardView(TemplateView):
|
209 | 209 | After processing the request using the `dispatch` method, the |
210 | 210 | response gets updated by the storage engine (for example add cookies). |
211 | 211 | """ |
212 | | # add the storage engine to the current formwizard instance |
| 212 | # add the storage engine to the current wizardview instance |
213 | 213 | self.wizard_name = self.get_wizard_name() |
214 | 214 | self.prefix = self.get_prefix() |
215 | 215 | self.storage = get_storage(self.storage_name, self.prefix, request, |
… |
… |
class WizardView(TemplateView):
|
512 | 512 | |
513 | 513 | .. code-block:: python |
514 | 514 | |
515 | | class MyWizard(FormWizard): |
| 515 | class MyWizard(WizardView): |
516 | 516 | def get_context_data(self, form, **kwargs): |
517 | 517 | context = super(MyWizard, self).get_context_data(form, **kwargs) |
518 | 518 | if self.steps.current == 'my_step_name': |
… |
… |
class NamedUrlWizardView(WizardView):
|
636 | 636 | def post(self, *args, **kwargs): |
637 | 637 | """ |
638 | 638 | Do a redirect if user presses the prev. step button. The rest of this |
639 | | is super'd from FormWizard. |
| 639 | is super'd from WizardView. |
640 | 640 | """ |
641 | 641 | prev_step = self.request.POST.get('wizard_prev_step', None) |
642 | 642 | if prev_step and prev_step in self.get_form_list(): |
… |
… |
class NamedUrlWizardView(WizardView):
|
646 | 646 | |
647 | 647 | def render_next_step(self, form, **kwargs): |
648 | 648 | """ |
649 | | When using the NamedUrlFormWizard, we have to redirect to update the |
| 649 | When using the NamedUrlWizardView, we have to redirect to update the |
650 | 650 | browser's URL to match the shown step. |
651 | 651 | """ |
652 | 652 | next_step = self.get_next_step() |
… |
… |
class NamedUrlSessionWizardView(NamedUrlWizardView):
|
680 | 680 | |
681 | 681 | class NamedUrlCookieWizardView(NamedUrlWizardView): |
682 | 682 | """ |
683 | | A NamedUrlFormWizard with pre-configured CookieStorageBackend. |
| 683 | A NamedUrlWizardView with pre-configured CookieStorageBackend. |
684 | 684 | """ |
685 | 685 | storage_name = 'django.contrib.formtools.wizard.storage.cookie.CookieStorage' |
686 | 686 | |