First: one cannot use  get_cleaned_data_for_step(*step*) 
<http://django-formtools.readthedocs.org/en/latest/_modules/formtools/wizard/views.html#WizardView.get_cleaned_data_for_step>
 
inside get_form_initial() (see: here 
<http://chriskief.com/2013/05/24/django-form-wizard-and-getting-data-from-previous-steps/>
).

Anyone familiar with FormWizard? I am a bit confused:
I want to use 'get_form_initial' to preset some values based on the choice 
in the previous step. ATM my code looks like this:
class JobWizard(CookieWizardView):
    form_list = [forms.JobForm, forms.TaskForm]
    def done(self, form_list, **kwargs):
        do_something_with_the_form_data(form_list) # todo
        return HttpResponseRedirect('/jobs/')

    def get_form_initial(self, step):
        current_step = self.storage.current_step
        print(current_step)
        print(self.steps.current)
        print('\n') 

        if current_step == '1':
            return self.initial_dict.get(step, {'deadline': timezone.now()})

        return self.initial_dict.get(step, {'street': self.storage.
current_step})  


The problem is that self.steps.current or self.storage.current_step don't 
work as I would expect: When working on the first form (forms.JobForm) it 
is '0' (as expected), but when submitting the first form and advancing to 
the second, it is still '0' (why?). So the above if clause if current_step 
== '1' does not work as I would like it to. Once I submit the second form 
self.steps.current is incremented. So maybe I'm using the wrong variable: 
How do I determine if I'm in the second step? How can I rename the step 
names? 

My goal at first is to load data from the first step and use it to preset 
some of the fields of the second step. Once that works I need to somehow 
create a formset for the different tasks... 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7887c1a-52ad-47cb-bf12-42f39bcb7d79%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to