Skip to content

Conversation

@jamesandres
Copy link
Contributor

This PR fixes an issue where named groups in choices would cause validation errors.

For example, this now works:

PROVINCES = (
    ("AB", "Alberta"),
    ("BC", "British Columbia"),
    # ... snip ...
)
STATES = (
    ("AL", "Alabama"),
    ("AK", "Alaska"),
    ("AZ", "Arizona"),
    # ... snip ...
)
PROVINCES_AND_STATES = (
    ("Canada - Provinces", PROVINCES),
    ("USA - States", STATES),
)

class Address(models.Model):
    # ... snip ...
    province_state = MultiSelectField(
        _('Province or State'), max_length=2, choices=PROVINCES_AND_STATES)
    # ... snip ...

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.12%) when pulling b7671d6 on jamesandres:named-groups into c232d17 on goinnn:master.

@blag
Copy link
Collaborator

blag commented Sep 22, 2016

Add a test for this and I'll merge it in. Thanks!

@blag blag mentioned this pull request Sep 22, 2016
@blag
Copy link
Collaborator

blag commented Sep 23, 2016

I cherry-picked this into master and added a test for it. Thanks for your contribution! 😄

@blag blag closed this Sep 23, 2016
@jamesandres
Copy link
Contributor Author

Thanks @blag! Sorry I haven't been so helpful, I wrote this PR to scratch an itch while working on a project quite a while back.

@blag
Copy link
Collaborator

blag commented Sep 25, 2016

@jamesandres No worries, merging it was easy! If you get a chance, test out the latest release and let me know how it is. 😄

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

Successfully merging this pull request may close these issues.

3 participants