So what your saying is that I'm not using CommaSeperatedIntegerField for its intended purpose? I should think about writing a set of custom fields? I just assumed support for this type of thing was built in. I will keep hunting.
On Apr 2, 1:50 pm, Bill Freeman <[email protected]> wrote: > I once saw something for this on djangosnippets. Search hard. > > > > On Fri, Apr 2, 2010 at 1:09 PM, ben <[email protected]> wrote: > > Hi, I am new to Django. I am currently using the latest Django 1.2 > > from trunk. I am trying to store a list of values in a > > CommaSeperatedIntegerList. I would like to use a > > CheckboxSelectMultiple widget to render and select the values in the > > list. I have setup my code like so. > > > SOME_CHOICES = (('1', 'ch1'),('2', 'ch2'), ('3', 'ch3'),('4',"ch4"), > > ('5',"ch5"),) > > > class QandA(models.Model): > > q1 = models.CommaSeparatedIntegerField(choices=SOME_CHOICES, > > max_length=100, null=True,blank=True) > > > class QandAForm(ModelForm): > > class Meta: > > model=QandA > > fields=['q1'] > > widgets={'q1':forms.CheckboxSelectMultiple,} > > > The form renders properly but I get the following validation error > > after posting. > > > "Select a valid choice. [u'1'] is not one of the available choices." > > > The same thing happens when I attempt to use SelectMultiple as the > > widget. Can anyone tell me what I am doing wrong? I have googled about > > but have not been able to find anything describing how to handle this. > > > Thanks, Ben > > > -- > > You received this message because you are subscribed to the Google Groups > > "Django users" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

