I'm trying to get the data from the session. The SessionWizard store the
data in the session

session_data = request.session[wizard_key_form]['step_data']

at this point session_data is the dictionary with the data in the form
filled by the user.

But this doesn't work

ServiceCreationWizard.as_view(
        FORMS,
        initial_dict=session_data,
    )(request)


Working with ipdb and django toolbar and reading the docs here[1] seems to
me that the fields name in the session dictionary are a little different
from the forma requested by the initial_dict

initial_dict wants something like

initial = {
...     '0': {'subject': 'Hello', 'sender': 'u...@example.com'},
...     '1': {'message': 'Hi there!'}
... }

but session are stored in this way

 u'step_data': {
      u'0': {u'0-subject': u'Hello', u'0-sender': u'u...@example.com'}
      u'1': {u'1-message': u'Hi there!'},
}

Do I have to convert all the keys name to pass the session values to the
initial_dict? Maybe there is a better way to backup and restore the session?

Thank you


[1]
https://docs.djangoproject.com/en/1.7/ref/contrib/formtools/form-wizard/#django.contrib.formtools.wizard.views.WizardView.initial_dict



On Wed, Feb 25, 2015 at 12:14 PM, Karim <lemieli...@gmail.com> wrote:

> When I click on the link for my form,
> ​[...]
>

-- 
Karim N. Gorjux

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CACeuRGW5L1ZupsnW49UCYD_GO7vszxXBh%2BKmjKYSQwcrVryHjg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to