Hi,

I tried to post this two hours ago, but it did not show up. So sorry
if this is the second copy.

I use "checkboxed" ModelMultipleChoiceField w/o any problems. Here is
a snippet:

class PictureForm(ModelForm):
    tags = ModelMultipleChoiceField(queryset=Tag.objects.all(),
widget=CheckboxSelectMultiple, required=False)
    class Meta:
        model  = Picture
        fields = ('title', ..., 'tags')

def edit_picture(request, pic_id):
    pic = get_object_or_404(Picture, pk=pic_id)

    if request.method == "POST":
        pic_form    = PictureForm(request.POST, instance=pic)
        if pic_form.is_valid() and photo_forms.is_valid():
            pic_form.save()
    else:
        pic_form    = PictureForm(instance=pic)

    return render_to_response("cat/edit_picture.html", dict(
        pic_form  = pic_form
    ))

Hope this helps.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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