Ale*_*and 4 django django-forms django-formwizard
有没有办法request
在Form Wizard的done()方法中访问变量?
class AddWizard(SessionWizardView):
def done(self, form_list, **kwargs):
if form_list[0].cleaned_data['ad_type'] == '1':
ad_type = 'basic'
else:
ad_type = 'other'
return render_to_response('business/done.html', {
'form_data': ad_type,
},
context_instance = RequestContext(request)
)
Run Code Online (Sandbox Code Playgroud)
我想访问请求中的用户对象,但我不确定如何将请求传递给done()方法?
是.SessionWizardView
扩展基础泛型,View
以便请求可用self.request
.
文档:https://docs.djangoproject.com/en/1.5/topics/class-based-views/generic-display/#dynamic-filtering