python - Django form wizard 'NoneType' object has no attribute 'rsplit' error -


hi hope can help, i've been trying out form wizard project , have been following documentation closely, keep getting error:

'nonetype' object has no attribute 'rsplit'

forms.py:

from django import forms   class contactform1(forms.form):     subject = forms.charfield()     sender = forms.charfield()   class contactform2(forms.form):     message = forms.charfield() 

views.py:

class contactwizard(wizardview):     def done(self, form_list, **kwargs):         return render_to_response('done.html', {             'form_data': [form.cleaned_data form in form_list],         }) 

and urls.py (atestapp 'woo')

urlpatterns = [     url(r'^admin/', include(admin.site.urls)),     url(r'^woo/', contactwizard.as_view([contactform1, contactform2])) ] 

traceback:

environment:  request method: request url: http://127.0.0.1:8000/woo/  django version: 1.8.4 python version: 3.4.0 installed applications: ('django.contrib.admin',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles',  'formtools') installed middleware: ('django.contrib.sessions.middleware.sessionmiddleware',  'django.middleware.common.commonmiddleware',  'django.middleware.csrf.csrfviewmiddleware',  'django.contrib.auth.middleware.authenticationmiddleware',  'django.contrib.auth.middleware.sessionauthenticationmiddleware',  'django.contrib.messages.middleware.messagemiddleware',  'django.middleware.clickjacking.xframeoptionsmiddleware',  'django.middleware.security.securitymiddleware')   traceback:      file "c:\python34\lib\site-packages\django\core\handlers\base.py" in get_response       132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)     file "c:\python34\lib\site-packages\django\views\generic\base.py" in view       71.             return self.dispatch(request, *args, **kwargs)     file "c:\users\pdelarosa\appdata\roaming\python\python34\site-packages\formtools\wizard\views.py" in dispatch       235.             getattr(self, 'file_storage', none))     file "c:\users\pdelarosa\appdata\roaming\python\python34\site-packages\formtools\wizard\storage\__init__.py" in get_storage       13.         storage_class = import_string(path)     file "c:\python34\lib\site-packages\django\utils\module_loading.py" in import_string       21.         module_path, class_name = dotted_path.rsplit('.', 1)      exception type: attributeerror @ /woo/     exception value: 'nonetype' object has no attribute 'rsplit' 

whenever go woo/ url shows nonetype error split. i've tried redoing whole thing still same error. hope can help.

instead of subclassing wizardview, try subclassing sessionwizardview:

from formtools.wizard.views import sessionwizardview  class contactwizard(sessionwizardview):     ... 

the documentation isn't clear on this, in cases shouldn't subclass wizardview directly - instead there number of sub-views should use:

sessionwizardview cookiewizardview namedurlwizardview etc.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -