Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiSelectFormField flat_choices attribute error in v0.1.13 #155

Open
mikemanger opened this issue Jul 8, 2024 · 0 comments
Open

MultiSelectFormField flat_choices attribute error in v0.1.13 #155

mikemanger opened this issue Jul 8, 2024 · 0 comments

Comments

@mikemanger
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant