django formwizard NoFileStorageConfigured

481 views
Skip to first unread message

danoro

unread,
Mar 11, 2012, 8:27:33 AM3/11/12
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 ?

Kenneth Love

unread,
Oct 23, 2012, 6:47:46 PM10/23/12
to django...@googlegroups.com
I've just been hit by this too, exactly the same set up and problem. I'd love a fix/solution.

Russell Keith-Magee

unread,
Oct 23, 2012, 8:26:17 PM10/23/12
to django...@googlegroups.com

Have either of you done a search of Trac to see if this issue has been reported previously? If there isn't, could you please open a ticket so that the problem isn't forgotten.

Yours,
Russ Magee %-)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/9-yHc9eJn4wJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Adonis Nafeh

unread,
Oct 4, 2013, 4:44:34 PM10/4/13
to django...@googlegroups.com
I ran into the same error. Using files in formwizard requires configuring File Storage, according to docs https://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/#handling-files

initializing file_storage fixed it for me.  

from django.core.files.storage import FileSystemStorage

class AppWizard(SessionWizardView):
    file_storage = FileSystemStorage(location=os.path.join(settings.MEDIA_ROOT))

Reply all
Reply to author
Forward
0 new messages