#31026: Switch form rendering to template engine
------------------------------------------------+--------------------------
               Reporter:  Johannes Hoppe        |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  assigned
              Component:  Forms                 |        Version:  master
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+--------------------------
 We recently switched widgets to use the template engine and template that
 can be overwritten.
 That is currently not the case for forms themselves. More precisely
 `django.forms.BaseForm.as_table` and it's siblings.
 They use string modulation, that they pass on to the `_html_output`, which
 generates the context.

 I would propose to change the behavior the following way:
 Have `_html_output` produce a context and don't actually perform a render.
 have each `as_XYZ` method get the context and perform a template based
 render.

 This allows to overwrite or add a new `as_XY` method and inject something
 into the context or change the template.


 This is also an opportunity to simplify the code. Since templates to
 render attributes already exist.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31026>
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/052.0ddd51ccbeb4c770bfc585c548c9b8d8%40djangoproject.com.

Reply via email to