On 9/14/06, Matthew Flanagan <[EMAIL PROTECTED]> wrote: > > On 14/09/06, Brantley Harris <[EMAIL PROTECTED]> wrote:
> > For instance, using the given example: > > message = TextField(label='Your message', > > attributes={'class':'vRichTextField'}) > > > > +1 on this for me. I'd love to be able to do: > > author = SelectField(attributes={'dojoType': 'Select'}) Agreed on the need, not on the implementation. My understanding is that idea of the .as_text, etc, modifiers on FormFields is to allow a FormField to be represented in different ways on a page; to me, putting attributes in the field definition implies that every renderer (as_text, as_select, etc), should use that attribute. IMHO, a better approach would be to allow rendering extensions to be registered on the field itself; e.g., author = SelectField(extra_renderers={'dojo':dojo_renderer, 'brantley':brantley_renderer}) The goal being to allow: - {{ form.author }} to render as a the default widget, without dojo or class modifications - {{ form.author.as_dojo }} to render as a 'dojo-ified' widget - {{ form.author.as_brantley }} renders with a modified 'class' attribute The onus is then on the underlying as_text/as_select etc implementations to allow easy modification/extension of attributes; e.g., class SelectField: ... def as_select(self, **kwargs): _class = kwargs.getdefault('class','vSelectMultiple') return "<select class='%s'>...</select>' % _class def brantley_renderer(self): return self.as_select(class='vBrantleyClass') Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---