I am getting the values from checkbox field from django custom form as shown below
error = forms.MultipleChoiceField(widget=CheckboxSelectMultiple(), choices = Error)
[u'None', u'Error',u'Fixed']
Now when I am inserting the above values in database the value is taking the entire list in the db field. I want to get the values as None,Error,Fixed without [] brackets. Is there any magic in python for doing so? Please help me this will be really helpful for my reporting stuff. Thanks in advance
I got the solution by this way
Now this gives the output
Now I am inserting the above values in database (this is for checkbox values captured from django form). At this stage I have one more problem, while retrieving the contents, I am getting in unicode
k="['None', 'Error', 'Fixed']"I have solved this problem by using eval method. for converting the string to list
new_list=eval(k)which gives the output['None', 'Error','Fixed']My problem got solved. Thanks for giving the little clue. 🙂