danoro
unread,Mar 11, 2012, 8:27:33 AM3/11/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
[ACTION]
Subclass NamedUrlSessionWizardView and instantiate it with a set of
forms one of them containing a FileField
class CommonWizardView(NamedUrlSessionWizardView):
pass
class FamilyWizardView(CommonWizardView):
pass
[RESULT]
File "/accounts/urls.py", line 66, in <module>
family_wizard = FamilyWizardView.as_view(named_family_forms,
url_name='family_step', done_step_name='family_wizard')
File "python2.7/site-packages/django_formwizard-1.0-py2.7.egg/
formwizard/views.py", line 109, in as_view
initkwargs = cls.get_initkwargs(*args, **kwargs)
File "python2.7/site-packages/django_formwizard-1.0-py2.7.egg/
formwizard/views.py", line 583, in get_initkwargs
initkwargs = super(NamedUrlWizardView, cls).get_initkwargs(*args,
**kwargs)
File "python2.7/site-packages/django_formwizard-1.0-py2.7.egg/
formwizard/views.py", line 166, in get_initkwargs
raise NoFileStorageConfigured
TemplateSyntaxError: Caught NoFileStorageConfigured while rendering
[CAUSE]
class WizardView(TemplateView):
@classmethod
def get_initkwargs(cls, form_list, initial_dict=None,
instance_dict=None, condition_dict=None, *args, **kwargs):
"""
Creates a dict with all needed parameters for the form wizard
instances.
"""
....
# check if any form contains a FileField, if yes, we need
a
# file_storage added to the wizardview (by subclassing).
for field in form.base_fields.itervalues():
if (isinstance(field, forms.FileField) and
not hasattr(cls, 'file_storage')):
raise NoFileStorageConfigured
[RESOLUTION]
subclassing is not enough. I inherited from both
NamedUrlSessionWizardView and FileSystemStorage, as shown below, but I
keep getting this error.
class FamilyWizardView(CommonWizardView, FileSystemStorage):
pass
I noticed an instance variable in formwizard called storage_name but
it is used for child clasess Session and Cookie WizardViews. Si it's
no relevant
please, could you shed some light ?