#15667: Implement template-based widget rendering ---------------------------------------+-------------------------- Reporter: brutasse | Owner: brutasse Type: New feature | Status: new Milestone: 1.4 | Component: Forms Version: | Severity: Normal Resolution: | Keywords: Triage Stage: Accepted | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 ---------------------------------------+-------------------------- Changes (by brutasse):
* easy: => 0 Comment: Some progress since the last update. The changes can be seen here: https://github.com/brutasse/django/compare/15667-template-widgets Carl, I integrated your suggestion to use {{{django.forms.__file__}}} to locate the forms templates. I have to agree the coupling between the template system and the forms library may be an issue. Maybe this should be discussed on django-dev but the GSoC proposal about form rendering is going to make this coupling even stronger if it gets merged. Almost all admin widgets have been converted. All tests now pass, I added a test for the admin !RadioInput widget. Now for some discussion: - the MultiWidget class has a format_output() method that joins the outputs from all of its widgets. The base MultiWidget just does "".join(outputs) but in the admin (see !AdminSplitDateTimeWidget) it inserts some markup between the outputs. I'm not sure of the best way to move this to the templates... Remove format_output and make MutiWidget use a higher-level template? Leave it as it is and let the users decide if they want format_output to use the template system or string interpolation? - Same for RelatedFieldWidgetWrapper. This basically wraps a widget, gets its output and adds the "Add Another" link next to it. I'd be tempted to make its render() method render the widget a separate template for the "Add Another" button, then join the outputs. Not sure if there are better options. After these two points, the roadmap is to add tests for the extension points (get_context_data, get_context, template_name) and document it as a public API. Let me know if I overlooked something! -- Ticket URL: <http://code.djangoproject.com/ticket/15667#comment:14> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.