Skip to content
This repository was archived by the owner on Dec 23, 2018. It is now read-only.
This repository was archived by the owner on Dec 23, 2018. It is now read-only.

Error when using conditional skipping #27

@nickdjones

Description

@nickdjones

I have 3 checkboxes on page 1 of my formwizard, one each representing pages 2, 3 and 4. If I write a generic conditional function to skip any of those pages if the checkbox on 1 is not ticked, and I also have "{% if wizard.steps.prev %}" or "{{ wizard.steps.step1 }}" in my template, I get the error "Caught ValueError while rendering: u'X' is not in list" where X is the index of the page that has been skipped.

Example conditional function:

def check_types(wizard):
current_step = wizard.steps.current
cleaned_data = wizard.get_cleaned_data_for_step('1') or {}
if current_step == '2' and 'option1' not in cleaned_data:
return False
if current_step == '3' and 'option2' not in cleaned_data:
return False
if current_step == '4' and 'option3' not in cleaned_data:
return False
return True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions