Hi,

Le 11 juil. 2010 à 17:36, Russell Keith-Magee a écrit :
> I'd like to propose a few extensions to Django's form library for 1.3.
First of all, thanks or your proposal, the current form rendering is the worst 
part of Django to me and I'd like to help to improve that in 1.3.

> Layout
> ------
> style, we can get that by simply loading a different renderer that
> implements that style:
> 
> {% load custom_renderer %}
> {% form myform %}
> 
> Django would ship with {% form %} implementations of the 'as_p' and
> 'as_ul' strategies, so getting 'as_p' rendering would mean:
> 
> {% load xhtml_p_forms %}
> {% form myform %}

Just a personal feedback, to me the rendering strategy is related to a whole 
project and should be defined in settings, it's too easy to forget a loading in 
a template. I know that you can use the django.template.add_to_builtins 
function but it in this case it should be documented.

> 
> Widgets
> -------
> 
> Chrome can also be parameterized; for example:
> 
> {% form myform field name using autocomplete:"name_autocomplete" %}
> 
> might define a chrome that implements an Ajax autocomplete widget
> using the named URL "name_autocomplete" as a data source. This has to
> potential to start giving an answer to the "Why doesn't Django do
> AJAX" monkey; Django won't provide an AJAX solution out of the box,
> but packaging a chrome that implements AJAX should be a lot easier.

If it requires an extra {% form %} arg it will not be that easier if you need 
to override all third-party apps' templates. Note that I haven't got any 
solution, that's more to bring the discussion on that topic :-).

> 
> Doctypes
> --------
> 
> Once these two changes are in place, we use the form template tag
> specify the doctype that is passed to the widget render call. A
> 'html5_p_forms' library will pass 'html5' as the doctype when
> rendering fields, and get HTML5-compliant form fields; the
> 'xhml1_p_forms' library will pass 'xhtml1', and get XHMTL1-compliant
> form fields.
Again, why not directly in settings in order to be project's specific? Is there 
anybody mixing doctypes on the same website? (backward compatibility maybe?)

Regards,
David

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to