On Sep 28, 1:13 am, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> Joseph Kocherhans wrote:
> > On Sun, Jul 6, 2008 at 6:27 AM, Ivan Sagalaev
> > <[EMAIL PROTECTED]> wrote:
> >> ## Proposal
>
> >> To fix this I was thinking along the lines of:
>
> >>     class ArticleForm(ModelForm):
> >>         class Meta:
> >>             model = Article
> >>             fields = ['author', 'text']
> >>             widgets = {
> >>                 'text': Textarea(...),
> >>             }
>
> >> I know it can be done now with formfieldcallback but it doesn't look
> >> nearly as readable because you have to write an imperative logic
> >> comparing field names.
>
> > +1. I think this would wrap up one of the last reasons to use
> > formfield_callback, but I think it should be on the post-1.0 list.
>
> Hello everyone!
>
> I've just got to implementing this:http://code.djangoproject.com/ticket/9223
>
> The patch is rather simple, backwards-compatible, contains tests and
> docs. I suppose docs require some proof-reading, as usual.

I've always just done this by doing:

MyForm(ModelForm)
    model = MyModel
    def __init__(self, *args, **kwargs):
        self.fields['name'].widget = Textarea()   # or whatever

Do we really need another way of doing this? Or am I overlooking
something that this new method introduces?

Something else to consider is how this effects subclasses (I haven't
thought to much about it, just raising a potential gotcha)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to