Django FormWizard and view
Basically, I just want to be able to get the parameter community_name, can this be done with
(r'^(?P<community_name>\w+)/matches/submit/$', MatchWizard([MatchStep1Form, MatchStep2Form, MatchStep3Form]))开发者_如何学运维,
or do I need a view? If I have a view, I can have the URLConf like
(r'^(?P<community_name>\w+)/matches/submit/$', "matches.views.submit_form"),
and do the normal view procedure, def submit_form(request, community_name):
Any idea? Thanks
posting the solution I found out. After taking a look at the source code of FormWizard
, I noticed the variable community_name is available at kwargs
of parse_params
def parse_params(self, request, *args, **kwargs):
community = get_object_or_404(Community, slug=kwargs['community_name'])
self.extra_context['community'] = community
精彩评论