summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2012-11-01 16:11:05 -0400
committerTim Graham <timograham@gmail.com>2012-11-01 16:14:51 -0400
commitaf7ea808d8540d1be87d89172f371ac928ff5c19 (patch)
tree43179664bf7edbc2ae8cfa007970a58555a26aec /django
parentd9213d09dbb28f687b53d051cddcae03337066c8 (diff)
Added WizardView.file_storage exception message and docs
Thanks Danilo Bargen for the patch.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/formtools/wizard/storage/base.py8
-rw-r--r--django/contrib/formtools/wizard/views.py12
2 files changed, 13 insertions, 7 deletions
diff --git a/django/contrib/formtools/wizard/storage/base.py b/django/contrib/formtools/wizard/storage/base.py
index aafc833484..2e59679d09 100644
--- a/django/contrib/formtools/wizard/storage/base.py
+++ b/django/contrib/formtools/wizard/storage/base.py
@@ -69,7 +69,9 @@ class BaseStorage(object):
wizard_files = self.data[self.step_files_key].get(step, {})
if wizard_files and not self.file_storage:
- raise NoFileStorageConfigured
+ raise NoFileStorageConfigured(
+ "You need to define 'file_storage' in your "
+ "wizard view in order to handle file uploads.")
files = {}
for field, field_dict in six.iteritems(wizard_files):
@@ -81,7 +83,9 @@ class BaseStorage(object):
def set_step_files(self, step, files):
if files and not self.file_storage:
- raise NoFileStorageConfigured
+ raise NoFileStorageConfigured(
+ "You need to define 'file_storage' in your "
+ "wizard view in order to handle file uploads.")
if step not in self.data[self.step_files_key]:
self.data[self.step_files_key][step] = {}
diff --git a/django/contrib/formtools/wizard/views.py b/django/contrib/formtools/wizard/views.py
index ea41e86852..5b45267f36 100644
--- a/django/contrib/formtools/wizard/views.py
+++ b/django/contrib/formtools/wizard/views.py
@@ -174,7 +174,9 @@ class WizardView(TemplateView):
for field in six.itervalues(form.base_fields):
if (isinstance(field, forms.FileField) and
not hasattr(cls, 'file_storage')):
- raise NoFileStorageConfigured
+ raise NoFileStorageConfigured(
+ "You need to define 'file_storage' in your "
+ "wizard view in order to handle file uploads.")
# build the kwargs for the wizardview instances
kwargs['form_list'] = init_form_list
@@ -436,8 +438,8 @@ class WizardView(TemplateView):
def get_all_cleaned_data(self):
"""
Returns a merged dictionary of all step cleaned_data dictionaries.
- If a step contains a `FormSet`, the key will be prefixed with formset
- and contain a list of the formset cleaned_data dictionaries.
+ If a step contains a `FormSet`, the key will be prefixed with
+ 'formset-' and contain a list of the formset cleaned_data dictionaries.
"""
cleaned_data = {}
for form_key in self.get_form_list():
@@ -458,8 +460,8 @@ class WizardView(TemplateView):
def get_cleaned_data_for_step(self, step):
"""
Returns the cleaned data for a given `step`. Before returning the
- cleaned data, the stored values are being revalidated through the
- form. If the data doesn't validate, None will be returned.
+ cleaned data, the stored values are revalidated through the form.
+ If the data doesn't validate, None will be returned.
"""
if step in self.form_list:
form_obj = self.get_form(step=step,