On Sat, 2008-10-18 at 12:48 -0700, Jesse Young wrote:
> > 3. Meta attribute formfield_kwargs for model forms
> 
> It seems like the arguments to form fields can already be customized
> fairly easily using formfield_callback? In your example, I think you
> could accomplish the same thing using formfield_callback like this:
> 
>     formfield_callback = lambda f:  f.formfield(**{
>          'user': {'queryset': User.objects.exclude(is_superuser=True),
> 'attrs': {'class': 'important'}},
>          'user_name': {'help_text': 'for anonymous users'},
>          'submit_date': {'widget': SpecialDateWidget},
>     }.get(f.name, {}))
> 
> ===
> 
> On a somewhat related note, 

You mean "on an entirely unrelated note except that it also has to do
with forms." :-)

> I think it would be nice if you could call
> mark_safe on the label attribute of a form field so it doesn't get
> escaped in _html_output. Currently if you want to put html in labels,
> it seems that you have to copy and paste the entirety of _html_output
> just to change one line (label = escape(force_unicode(bf.label)))

That sounds like a bug. Label attributes on form fields are not
use-generated. They're supplied by the developer (code writere), so they
should be treated as safe strings. Please open a ticket for this and
we'll fix it.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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