Friday, 15 April 2011

Django Form Wizard: How to make a "Confirmation" screen as the last step of your wizard? -



Django Form Wizard: How to make a "Confirmation" screen as the last step of your wizard? -

re-posting before question:

django formwizards: how painlessly pass user-entered info between forms?

i'm using formwizard functionality in django 1.4.3.

i have created 4-step form. in first 3 steps of form correctly takes info user, validates it, etc. in step #4, right shows "confirm" button. nil else. when nail "confirm" on step #4, useful in done() function. far works fine.

however, create in step 4 (the confirmation step), shows user info have entered in previous steps review. i'm trying figure out painless way create happen. far creating entry in context called formlist contains list of forms have been completed.

class my4stepwizard(sessionwizardview):

def get_template_names(self): homecoming [mywizardtemplates[self.steps.current]] def get_context_data(self, form, **kwargs): context = super(my4stepwizard, self).get_context_data(form=form, **kwargs) formlist = [self.get_form_list()[i[0]] in mywizardforms[:self.steps.step0]] context.update( { 'formlist': formlist, } ) homecoming context def done(self, form_list, **kwargs): # here. homecoming httpresponseredirect('/donewizard')

form #1 has input field called myfield. in template step #4, {{ formlist.1.clean_myfield }}. however, when that, next error:

exception value: 'my4stepwizard' object has no attribute 'cleaned_data'

it seems forms putting formlist unbounded. don't contain user's data. there prepare can utilize info itself? utilize context pass info i'm doing above.

if there aren't duplicate field names among 3 forms, can utilize wizardview.get_all_cleaned_data(). returns dict of info can passed on template via get_context_data() you're trying do. that's angle i'm taking, hoping find improve way.

django

No comments:

Post a Comment