goinnn/django-multiselectfield

How to set multiselectfield value

blackPython opened this issue · 0 comments

I have a question regarding how to set a field value using django models API.
Suppose I have model called Dummy which has a field by the name multiselect whose choices are [('HE','hello'),('BY','bye'),('CA','c ya')]. And if the I do this no error is thrown

`
dummy = Dummy()

dummy.multiselect = ['asdasd']

dummy.save()

del dummy

dummy = Dummy.objects.all()[0]

print dummy.multiselect
`
The last print statement print [u'asdasd'], but 'asdasd' is not a valid choice so I expect the code to throw an error why is not happening.
And I am not entirely sure how to assign and modify values of the field, and there nothing related to it in the short and inept documentation provided in the readme file. Please make this more clear for higher adaptation. I am using Django 1.11