Form Wizard: how to send instance_dict based on the request

34 views
Skip to first unread message

Karim

unread,
Feb 18, 2015, 1:26:30 AM2/18/15
to Django Users
Hello mates!

I have some problems to understand how to set the view for the NamedUrlSessionWizardView creating a instance_dict based on the user in the request.

in my urls.py

    url(r'wizard/new/(?P<step>.+)/$',
        ServiceCUWizard.as_view(
           FORMS,   # the list of ['form_name', form_object]
           url_name='service:new_wizard_step',
           done_step_name='finished',
        ), name='new_wizard_step'),

It works, I got all the forms as expected.

The forms are modelforms and I would like to bound the instance if is possible, but I can populate it only using the request. I think I could do that subclassing def __init__, but the instance_dict is a class attribute, how I can populate it?

Thnak you



-- 
Karim N. Gorjux

Collin Anderson

unread,
Feb 19, 2015, 6:49:37 PM2/19/15
to django...@googlegroups.com
Hi,

You could instead just override get_form_instance(step). That way you'll have access to self.request.

Collin

Karim

unread,
Feb 25, 2015, 1:17:43 AM2/25/15
to Django Users

On Fri, Feb 20, 2015 at 5:49 AM, Collin Anderson <cmawe...@gmail.com> wrote:
You could instead just override get_form_instance(step). That way you'll have access to self.request.

​Thank you!​



--
Karim N. Gorjux
Reply all
Reply to author
Forward
0 new messages