On Oct 18, 9:48 pm, Jesse Young <[EMAIL PROTECTED]> 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, {}))

Yes it is possible - but it is much more complicated. But it was
discussed in different thread (Declarative syntax for widgets in
ModelForm), I only propose more general syntax.

http://groups.google.com/group/django-developers/browse_thread/thread/f879f383870b92c1/9769c9a449237047?lnk=gst&q=widgets#9769c9a449237047

> ===
>
> On a somewhat related note, 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)))

I think it can be solved very easy - replace "escape" by
"conditional_escape". It seems to be a bug, not a feature. But
mark_safe would work with my proposal also - powerful and flexible
forms would be generated by templates, not by _html_output.
--~--~---------~--~----~------------~-------~--~----~
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