#32541: Separate context and rendering in forms
-------------------------------------+-------------------------------------
     Reporter:  Dylan Verheul        |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Forms                |                  Version:  3.1
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by David Smith):

 I think we need to be mindful of ticket #31026 and the associated
 [https://github.com/django/django/pull/12133 pr] which moves forms to a
 template render. For items such as labels they will be able to be
 customised via overriding a temple, which could be enough here?

 For widgets, there is already the ability to over ride templates, and if
 you want to go futher I find that a boundfield's `subwidgets`  usually has
 the information needed to render each widget. For example, it can include
 `selected` and built `attrs`. It's not clear from your ticket what extra
 context you would need that is only available via django rendering?

 Here's an example of the information available in a subwidget.

 │  choice_label = 1
 │          data = {
 │                     'name': 'checkbox_select_multiple',
 │                     'value': 1,
 │                     'label': 1,
 │                     'selected': True,
 │                     'index': '0',
 │                     'attrs': {'id': 'id_checkbox_select_multiple_0',
 'checked': True},
 │                     'type': 'checkbox',
 │                     'template_name':
 'django/forms/widgets/checkbox_option.html',
 │                     'wrap_label': True
 │                 }
 │  id_for_label = 'id_checkbox_select_multiple_0'

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32541#comment:2>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.938ce06f6b3875460c64a3fb873eac85%40djangoproject.com.

Reply via email to