If I have a GENDER_CHOICE Tuple in a model like so:
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)
Could I use Integers a swell:
GENDER_CHOICES = (
('1', 'Male'),
('2', 'Female'),
)
And have a IntegerField(max_length=1) to write to ?
Thanks.
Absolutely, but
'1'and'2'are not integers (although they might still work through some magic).This would definitely work for an
IntegerField:I don’t believe an
IntegerFieldhas amax_lengthattribute. APositiveSmallIntegerFieldwould be appropriate if you want a small number of choices.