Rob Hudson wrote: > > 1. Display code should be separate from logic. Ideally, all HTML would > be in template files that one could override if need be in their own > template directory, just like the admin templates. If django.forms did > this, that would be great.
The forms framework I wrote out of frustration with django.[old]forms did this. I ended up with a number of tiny one-line templates. The template for a TextField, for example, was: <input type="{{ input_type|escape }}" id="{{ id|escape }}" class="{{ class_names|join:" "|escape }}" name="{{ widget_name|escape }}" size="{{ size|escape }}" value="{{ data|escape }}" {% if maxlength %}}maxlength="{{ maxlength|escape }}"{% endif %}{% if widget.readonly %} readonly="readonly"{% endif %}{% if widget.disabled %} disabled="disabled"{% endif %}/> My motivation for this change was less to allow the use of valid HTML (instead of XHTML), but to allow site-wide customisation of form elements (i.e. in ways beyond what CSS can do). > The only consideration I can think of is > what kind of load would this be to necessitate a file system call to > pull in the widget template or error template? I don't think that's generally an issue. If the Template instance is cached in the Widget instance, then each widget's template file need only be loaded and parsed once; and I don't expect the extra rendering will be a significant issue. > 4. One of the reasons I've seen touted for the template system not > having access to Python methods and having it's own language is the > benefit of separating the programmer from the designer and that > designers shouldn't need to know Python to create templates in Django. > But they would if they want to manipulate forms or form error feedback. > This should be consistent. This is IMO the best argument for this change. Being able to have a custom (but consistent site-wide) display of form labels & errors with only template overrides would be very nice indeed. Andrew --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---