On Tue, Feb 10, 2009 at 1:21 PM, Konstantin S <ktechli...@gmail.com> wrote:

>
> Hello
>
> I have a form created from forms.ModelForm and in my model one of the
> fields is m2m field. Now when form is displayed for that m2m filed I'd
> like to have something that looks like checkbox where user can select
> several alternatives. I know that I can use widgets here and there are
> some that can be used in my case, but I don't know how do I use them
> in case of form being generated as ModelForm ?

If you want to show multiple checkboxes, use CheckboxSelectMultiple widget.

Sample code:

class MyForm(forms.ModelForm):
    my_field = fields.ModelMultipleChoiceField(queryset=your_query_set,
widget=forms.CheckboxSelectMultiple)

--
Serge

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