On Nov 19, 1:28 am, geraldcor <gregco...@gmail.com> wrote:
> Ok,
>
> Here is how I do it if I am using a regular form with 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 a form wizard?
>
> Greg
>
> On Nov 17, 3:39 pm, geraldcor <gregco...@gmail.com> wrote:
>
> > Hello all,
>
> > I began making a form that 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
> > those initial values in the form. 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 a form wizard are stored in the
self.initial[] list. It means, that to set set initial values for the
form in 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 the wizard instance (or parse_params, if you
need to set initial values for the form in 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=.


Reply via email to