Skip to content

MultiSelectFormField flat_choices attribute error in v0.1.13 #155

Closed
@mikemanger

Description

@mikemanger

Running existing projects gives the following error:

/multiselectfield/forms/fields.py", line 30, in __init__
    self.flat_choices = kwargs.pop('flat_choices')
KeyError: 'flat_choices'

My form classes look like this

class MyForm(forms.Form):
    CHOICES = (
        ('a', 'A'),
        ('b', 'B'),
    )

    reason = MultiSelectFormField(choices=CHOICES, widget=forms.CheckboxSelectMultiple, required=False)

In #118 (diff ref) MultiSelectFormField now requires a flat_choices field - isn't this the same as the inherited choices attribute?

Adding flat_choices=CHOICES fixes the issue but it would be nice to know if this change was intended or if its purpose could be documented (I appreciate the original PR is years old so this might not be known!)

PS thanks for the recent activity! <3

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