On 12/17/06, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
>
> Adrian Holovaty wrote:
> > Yes, there should be a way to specify the widget for a field in the
> > model. The question is, should it be specified as a keyword argument
> > to the field declaration, or should it be passed in the "class Admin"?
>
> Would it be better to specify it as and additional parameter form
> form_for_model? I remember having a need to display a field differently
> in different forms.
it would be nice to override it, but I IMHO in most cases it is useful
to specify it on the field-level. So when admin and generic views
start to use newforms it will be there.
But if you would want to override this when creating a Form from
fields, things would get a bit more complicated:
you would have to/be able to specify:
field itself
field name,
widget,
default value (why not, if we already have all those other params),
label,
...
where only field should be required...
perhaps this could be done by passing a dictionary with fields as keys
and either only true or a dictionary of options as value
{
Object._meta.fields[0] : True,
Object._meta.fields[1] : {
'name' : 'Custom Name',
'widget' : SuperWidget,
....
}
}
what do you think? its just a first thought
>
> Like:
>
> form_for_model(..., widgets = {'field_name': WidgetClass})
>
> >
>
--
Honza Král
E-Mail: [EMAIL PROTECTED]
ICQ#: 107471613
Phone: +420 606 678585
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---