On 12/10/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > What if instead of adding various as_* methods that we have a > FormFormatter class that determines how the form displays. The > _html_output and as_* methods would become FormFormatters. Formatter > could be a parameter to the Form constructor, and could default to the > table formatter like how it is now. This would make Form display with > its FormFormatter similar to a form Field and its Widget. > > This might even be something that would make sense as a setting, > default_formformatter. Usually one would not be mixing and matching > more than one formatter for a given site. If I wanted to change the > display of all the forms on my site, I could make the change in one > place instead of having to change all the as_p in my templates to > as_my_p.
This is an interesting idea, but I think it's important to remember the as_p(), as_table() and as_ul() shortcut methods are just *shortcuts*. There's nothing stopping a developer from writing a custom method on a Form, nor is there anything stopping a developer from building the form "by hand" by piecing together the individual fields. as_p(), as_table() and as_ul() are just shortcuts for the common (lazy) case when the developer doesn't want to spend time customizing a form's display in the template. In my opinion, it would be overengineering to create a separate framework (e.g., the proposed FormFormatters) to provide for generic ways of being lazy. Put another way, if we had a FormFormatter framework, that would encourage people to use these "generic" form formats rather than giving tender loving care to the design of each form, which is what I'd rather encourage. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---