django-select-multiple-field
django-select-multiple-field copied to clipboard
int values are converted to strings
if I have the following choices:
MY_CHOICES = ( (0, _('val1)), (1, _('val2')), )
I get an array ["0", "1"]
This is a limitation of the field. It requires strings. I'll change the docs to make it explicit.
If you needed to have integer choices you would probably have to subclass the field. I don't see a way to detect a difference between u'1' and 1 once it is stored. The storage of choices is delegated to a CharField. For example, in the db you have:
choices: '1,2,3,4'
Does that mean you should return to the user: [1,2,3,4] or ['1','2','3','4']
? You cannot tell based on the values in the field.
but you could tell based on the choices... But it is alright! I did not realize, that it is a subclassed select widget.