So I successfully used this method to add initial values using
parse_params as I was dealing with step 0. However, now the client
wants the form order changed so that what was step 0 is now step 2. I
tried using process_step in the exact same way as parse_params, but
the values are not filled in. I can't figure out how to use
process_step like I was able to use parse_params.

this is what I tried

def process_step(self, request, form, step):
                profile={}
                profile=request.user.get_profile()
                if step == 2:
                        init={
                                'company': profile.defaultcompany,
                                'contact': profile.defaultcontact,
                                'address1': profile.defaultaddress1,
                                'address2': profile.defaultaddress2,
                                'address3': profile.defaultaddress3,
                                'city': profile.defaultcity,
                                'state': profile.defaultstate,
                                'zip': profile.defaultzip,
                                'country': profile.defaultcountry,
                                'faxareacode': profile.defaultfaxareacode,
                                'fax': profile.defaultfax,
                                'areacode': profile.defaultareacode,
                                'phone': profile.defaultphone,
                                'email': profile.defaultemail,
                                'billingcompany': profile.billingcompany,
                                'billingname': profile.billingname,
                                'billingaddress1': profile.billingaddress1,
                                'billingaddress2': profile.billingaddress2,
                                'billingaddress3': profile.billingaddress3,
                                'billingcity': profile.billingcity,
                                'billingstate': profile.billingstate,
                                'billingzip': profile.billingzip,
                                'billingcountry': profile.billingcountry,
                                'billingfaxareacode': 
profile.billingfaxareacode,
                                'billingfax': profile.billingfax,
                                'billingareacode': profile.billingareacode,
                                'billingphone': profile.billingphone,
                                'billingemail': profile.billingemail,
                        }
                        if profile.sendreportsto:
                                init['sendreportsto']=profile.sendreportsto
                        else:
                                init['sendreportsto']='Please use the 
format:\nName n...@email.com,
\nName2 na...@email.com'
                        self.initial[2]=init
Thanks for any more help.

On Nov 19, 5:56 pm, geraldcor <gregco...@gmail.com> wrote:
> This worked perfectly. Thank you. I used parse_params because I needed
> to add default company profile stuff to the first wizard form. Thank
> you again for clearing up my ignorance.
>
> Greg
>
> On Nov 18, 9:10 pm, "Mark L." <mark.l...@gmail.com> wrote:
>
> > On Nov 19, 1:28 am, geraldcor <gregco...@gmail.com> wrote:
>
> > > Ok,
>
> > > Here is how I do it if I am using a regularformwith a regular view:
>
> > > profile = request.user.get_profile()
> > >form= MyForm('company': profile.defaultcompany, 'contact':
> > > profile.defaultcontact, etc...})
> > > return render_to_response('forms/submit.html', {'form':form},
> > > context_instance=RequestContext(request))
>
> > > pretty simple and basic.
>
> > > How do I do this with aformwizard?
>
> > > Greg
>
> > > On Nov 17, 3:39 pm, geraldcor <gregco...@gmail.com> wrote:
>
> > > > Hello all,
>
> > > > I began making aformthat used request.user.get_profile to get
> > > > default values for company name, phone, email etc. I have since
> > > > decided to move to a formwizard to split things up. I have no idea how
> > > > to override methods for the formwizard class to be able to include
> > > > thoseinitialvalues in theform. Can someone please help me with this
> > > > problem or point me to the proper help? I have come up short with all
> > > > of my searching. Thanks.
>
> > Hello,
>
> > The *initial* values for the forms in aformwizardare stored in the
> > self.initial[] list. It means, that to set setinitialvalues for theformin 
> > step X you do the following:
>
> > init = {
> >     'key1':'val1',
> >     'key2':'val2',
> >     etc..
>
> > }
>
> > self.initial[X] = init
>
> > The best (and, indeed, about the only place to handle this) is the
> > process_step method of thewizardinstance (or parse_params, if you
> > need to setinitialvalues for theformin step 0).
>
> > Hope that helps
>
> > Mark
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to