> class ArticleForm(ModelForm): > class Meta: > model = Article > fields = ['author', 'text'] > widgets = { > 'text': Textarea(...), > }
Why stop at widgets? Let's say I want to change just the label of a field, or the the choices option of a ModelChoiceField - I also have to redefine the whole field. Why not do something like: class ArticleForm(ModelForm): text = {'widget': 'Text'} author = {'label': Textarea(...)} class Meta: model = Article fields = ['author', 'text'] Or, more explicit: class ArticleForm(ModelForm): text = Attrs(widget='Text') By the way, IIRC the following should already somewhat do what you want in most cases, although it's obviously not very nice: class ArticleForm(ModelForm): author = Article._meta.get_field('author').formfield(**custom_options) class Meta: model = Article Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---