dj.choices icon indicating copy to clipboard operation
dj.choices copied to clipboard

Use Country (not Gender) if we're _in_south

Open supervacuo opened this issue 11 years ago • 2 comments

ChoiceField sets its own choices property to deal with South having removed it, but this leads to an error (e.g. '5' is not a valid choice) if a model has a ChoiceField with more than 3 choices, and an instance with a higher-numbered choice exists in the database during a migration.

This commit uses dj.choices.Country instead, which means we're now good up to 215 items...

supervacuo avatar Dec 19 '13 13:12 supervacuo

I am having same issue! using Country as choices for ChoiceField. And i can't do datamigration, it always fails on TypeError: format requires a mapping. Line 82 in dj.choices.fields.

@supervacuo your solution helped me find the culprit causing all this fuss.

Luckily for me, i had Sports created, with ~1000 choices, cos switching to Country didnt help me

Is there no way to fix this without being dependent on other Choices model? Why does south remove choices from ChoiceField?

neara avatar Jan 29 '14 11:01 neara

@neara see #6 — although NB Django 1.7 is about to be released, which deprecates South. Fingers crossed that someone finds time to write the new introspection rules if they're still required.

supervacuo avatar May 21 '14 12:05 supervacuo