On Wed, Sep 10, 2008 at 12:43 PM, Simon Willison <[EMAIL PROTECTED]> wrote: > Django proper was to modify Django's widget.render method to take an > optional as_xhtml=True/False argument. The {% form %} tag would then > set that argument based on context._doctype. > > I would also modify Context to have an is_xhtml() method which does > the "self._doctype in xhtml_doctypes" check.
This isn't forms specific, but I have various classes that output HTML into templates and one pattern I've used is to take the context in their render() method, then display the variable with a tag that calls render(), like: {% render my_variable %} I think it'd be interesting to apply this pattern to general variable lookups, as it would solve this issue, plus be applicable to many more problems. Variable lookups could check for render() and call it if it's there, passing the context. Then you just call {{ my_variable }}, or {{ field }}. Too big of a change? -Justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---