Bah, it was just prototype code but point taken ;) I do feel like it leads to slippery slope though. LikeMichael said, "why stop at widgets?" I often need to change labels and help text too.
On Sep 29, 8:56 pm, Ivan Sagalaev <[EMAIL PROTECTED]> wrote: > SmileyChris wrote: > > I've always just done this by doing: > > > MyForm(ModelForm) > > model = MyModel > > def __init__(self, *args, **kwargs): > > self.fields['name'].widget = Textarea() # or whatever > > You've forgot to call `super` :-). I know that it's only an example but > it adds another line and also shows that such things can easily be > forgotten in real code. > > > Do we really need another way of doing this? Or am I overlooking > > something that this new method introduces? > > I've addressed this exact thing my first email on subject, so quoting > myself: > > > Here the problem is that it has enough boilerplate code to be, shall we > > say, not beautiful. And also it defeats nice declarative nature of a > > ModelForm. > > So, yes, it's not the end of the world but it's the same convenience as > `fields` or `exclude` that all could be simulated in __init__. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---