> > Does anyone have an alternative method for dynamically specifying the
> > widget of a Form.Field? I do realize this could be done in a similar
> > fashion to the CSS, but I believe specifying a Django object as a
> > parameter to a template filter would then violate my front-end.
>
> I use newforms.form_for_model(...) to get my form classes; using them,
> you can just override the widget used at any time before instantiating
> the form itself:
>
> MyFormClass.base_fields['password'].widget = widgets.PasswordInput()
>
> It looks like you can do the same for the form itself, just substitute
> your form's name for MyFormClass

Thank you very much for the prompt reply. This is a great way of
changing widgets. From my point of view, however, the problem remains
that the the widget definition
is still in the middleware. Id like to define the Field widget in my
templates without using a django
object (ie. widgets.PasswordInput() ).  Im not sure if this even
possible, but it seems to be the most logical place to do it.

Kind regards,
Sebastian


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to