So I have a form:
class ProjectUpdateForm(ModelForm):
    products = MultipleChoiceField(label = u'Products', 
widget=CheckboxSelectMultiple)
    def __init__(self, *args, **kwargs):
        self.fields['products'].choices = [(x.code, x.name) for x in 
Product.objects.order_by('code')]
    ....

which was referenced from a view:
class ProjectUpdateView(UpdateView):
    model = Project
    form_class = ProjectUpdateForm
    ....

The products field can be created from a similar form successfully and saved 
to database CharField as a list of values. Eg. [u'A01', u'A02']. But for 
this update view, the corresponding checkboxs always keep unchecked, 
neglecting the field value of the model object.

What did I miss? Thanks in ad!

~hanson

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