I am rendering a ManyToManyField with a CheckboxSelectMultiple widget
like so:

class CreateBandForm(ModelForm):
    styles= forms.ChoiceField(widget=forms.CheckboxSelectMultiple(),
choices=[(i,i) for i in Style.objects.all()])

    class Meta:
        model = Band
        fields = ['name','styles']

This renders fine, but when I select a few choices (say 'latin
american' and 'rhythm and blues') and submit the form, I get the
following validation error:

     Select a valid choice. [u'latin american', u'rhythm and blues']
is not one of the available choices.

I have tried various permutations for "choices", including choices=
[(i.id,i) for i in Estilo.objects.all()], with no luck so far.

Thanks,

Rodrigo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to