Re: Custom widget for a modelform field

2010-03-08 Thread Daniel Roseman
On Mar 9, 7:20 am, Odd wrote: > It works fine if I'm not using a modelform, i.e. > > class MyForm(forms.Form): >    data=forms.CharField(widget=MySelect()) > > Can one not use a custom widget in a modelform? > > Thanks. The 'widgets' argument is new in the development version, it's not in 1.1. (I

Re: Custom widget for a modelform field

2010-03-08 Thread andreas schmid
i have customized multiselect widget on a model field and it works like this: class MyModelForm(ModelForm): field = ModelMultipleChoiceField(MyOtherModel.objects, required=False, widget=MultipleSelectWithPop) class Meta: model = MyModel let me know! Odd wrote: > It works

Re: Custom widget for a modelform field

2010-03-08 Thread Odd
It works fine if I'm not using a modelform, i.e. class MyForm(forms.Form): data=forms.CharField(widget=MySelect()) Can one not use a custom widget in a modelform? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

Custom widget for a modelform field

2010-03-08 Thread Odd
I'm trying to write a custom select widget for a modelform field, but the render method of the widget doesn't seem to get called. This is how I define the modelform: class MyForm(ModelForm): class Meta: model=MyModel fields=('data',) widgets = { 'data': MyS