Code

Ticket #11044: formwizard_extra_context_fix.diff

File formwizard_extra_context_fix.diff, 905 bytes (added by taylanpince, 5 years ago)

Patch to move extra_context declaration under init

Line 
1Index: django/contrib/formtools/wizard.py
2===================================================================
3--- django/contrib/formtools/wizard.py  (revision 10716)
4+++ django/contrib/formtools/wizard.py  (working copy)
5@@ -16,9 +16,6 @@
6 from django.contrib.formtools.utils import security_hash
7 
8 class FormWizard(object):
9-    # Dictionary of extra template context variables.
10-    extra_context = {}
11-
12     # The HTML (and POST data) field name for the "step" variable.
13     step_field_name="wizard_step"
14 
15@@ -26,6 +23,8 @@
16 
17     def __init__(self, form_list, initial=None):
18         "form_list should be a list of Form classes (not instances)."
19+        # Dictionary of extra template context variables.
20+        self.extra_context = {}
21         self.form_list = form_list[:]
22         self.initial = initial or {}
23         self.step = 0 # A zero-based counter keeping track of which step we're in.