TYPE1 = 0
TYPE2 = 1
OPEN_TYPES = (
(TYPE1, _(u"Test")),
(TYPE2, _(u"Test2")),
)
models:
models.CharField(max_length=10, choices=OPEN_TYPES)
I have this error if I try to add object in admin panel:
Select a Valid Choice. 0 is not one of the available choices
How to fix it?
You're using integer values with a CharField
. You have to either use the values '0'
and '1'
or change it to an IntegerField
.
Use a default value also that will work!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With