Hello,

I have a small issue, I am sure the solution is simple, but I couldn't
find it (I blame Monday). I have a model with a Many2Many field, and I
have a few forms for editing that model. Everything is working fine
there. In one specific case however I have to produce a form where the
user can select only one value for the Many2many field from a dropdown
list.

My initial idea was to override the form field:

content_categories = forms.ModelChoiceField( widget=forms.Select,
queryset=ContentCategory.objects.all(), required=True )

The form validates fine, but then it gives an error upon saving it:

File "[...]\django\db\models\fields\related.py" in __set__
  746.         manager.add(*value)
Exception Value: add() argument after * must be a sequence

ModelMultipleChoiceField is'nt working at all (as expected), giving
validation errors since it wants a list of items.

So any ideas before I handle the value manually in my view? :-)

--
Roodie

-- 
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