Question
En fait, je veux juste être en mesure d'obtenir le paramètre nom_communauté, cela peut être fait avec
(r'^(?P<community_name>\w+)/matches/submit/$', MatchWizard([MatchStep1Form, MatchStep2Form, MatchStep3Form])),
ou ai-je besoin d'une vue? Si j'ai vue, je peux avoir l'URLconf comme
(r'^(?P<community_name>\w+)/matches/submit/$', "matches.views.submit_form"),
et faire la procédure de vue normale, def submit_form(request, community_name):
Une idée? Merci
La solution
affichage de la solution que je l'ai découvert. Après avoir pris un coup d'oeil au code source de FormWizard
, j'ai remarqué la nom_communauté variable est disponible à kwargs
de parse_params
def parse_params(self, request, *args, **kwargs):
community = get_object_or_404(Community, slug=kwargs['community_name'])
self.extra_context['community'] = community
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow