[Answer]-Django WizardView with checkboxes in Form causes "ValueError too many values to unpack (expected 2)"

1👍

Your choices should be a list of iteratables of two items.

You could do either:

FRAME_AND_ALIGNMENT_CHOICES = [
    ("Align Derailleur Hanger", "Align Derailleur Hanger")
    ("Basic Clean", "Basic Clean"),
    ("Install Front Basket", "Install Front Basket"),
]

Or use a list comprehension to reduce duplication:

FRAME_AND_ALIGNMENT_CHOICES = [(c, c) for c in ["Align Derailleur Hanger", "Basic Clean", "Install Front Basket"]]

Or, you might want to store a code in the database, and display the full description to the user:

FRAME_AND_ALIGNMENT_CHOICES = [
    ("derailleur", "Align Derailleur Hanger"),
    ("clean", Basic Clean"),
    ("basket", "Install Front Basket"),
]

Leave a comment