On Sat, 2008-04-05 at 07:32 -0700, Iamnewbie wrote: > I want to use CheckboxSelectMultiple (checkbox) under modelform > instead of default ModelMultipleChoiceField settings. > > my codes are as follows: > > > class Form(ModelForm): > > def __init__(self, *args, **kwargs): > > super(Form, self).__init__(*args, **kwargs) > > > self.fields['condition'].widget=forms.CheckboxSelectMultiple > > > > class Meta: > model=Post > fields=('post_type', 'title', 'body', 'condition') > > > I got the error like: > > Exception Type: AttributeError > Exception Value: type object 'CheckboxSelectMultiple' has no > attribute 'attrs' > > > I am total lost on this problem. anyone may help me out? Thanks.
The "widget" attribute will be an instance, not a type, once newforms.fields.Field.__init__ has finished running. So you probably should be assigning CheckboxSelectMultiple() -- an instance, rather than than the class object. Regards, Malcolm -- The sooner you fall behind, the more time you'll have to catch up. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---