Skip to content

Instantly share code, notes, and snippets.

@hvdklauw
Created June 9, 2011 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hvdklauw/1016394 to your computer and use it in GitHub Desktop.
Save hvdklauw/1016394 to your computer and use it in GitHub Desktop.
Formwizard diff
Index: django/contrib/formtools/wizard/views.py
===================================================================
--- django/contrib/formtools/wizard/views.py (revision 16341)
+++ django/contrib/formtools/wizard/views.py (working copy)
@@ -96,6 +96,7 @@
instance_dict = None
condition_dict = None
template_name = 'formtools/wizard/wizard_form.html'
+ extra_context = None
def __repr__(self):
return '<%s: forms: %s>' % (self.__class__.__name__, self.form_list)
@@ -112,7 +113,7 @@
@classmethod
def get_initkwargs(cls, form_list,
- initial_dict=None, instance_dict=None, condition_dict=None):
+ initial_dict=None, instance_dict=None, condition_dict=None, **kwargs):
"""
Creates a dict with all needed parameters for the form wizard instances.
@@ -134,11 +135,11 @@
will be called with the formwizard instance as the only argument.
If the return value is true, the step's form will be used.
"""
- kwargs = {
+ kwargs.update({
'initial_dict': initial_dict or {},
'instance_dict': instance_dict or {},
'condition_dict': condition_dict or {},
- }
+ })
init_form_list = SortedDict()
assert len(form_list) > 0, 'at least one form is needed'
@@ -513,6 +514,7 @@
return context
"""
context = super(WizardView, self).get_context_data(*args, **kwargs)
+ context.update(self.extra_context or {})
context.update(self.storage.extra_data)
context['wizard'] = {
'form': form,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment