#33166: Missing context when rendering form widgets
-------------------------------------+-------------------------------------
Reporter: Jacob | Owner: nobody
Rief |
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: 4.0
Severity: Normal | Keywords: form, widget,
Triage Stage: | context
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Unsure if this shall be a feature request, but I noticed that when
rendering a field label, the template's rendering context additionally
contains the `field`- and the `form`-object. If however, I render the
widget itself, this information is not available inside the widget's
template rendering context. Apart from this inconsistency, being able to
access the `field`- and/or the `form`-object, when rendering a widget is
really useful.
Example:
I would like to use the `form`-attribute inside some `<input …>`-widgets,
so that each field can refer to its corresponding form. See
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-form
for details. The `form`-object itself provides a name, which is used as
the `<form id="…" …>`. Therefore each widget has to know their form's
name. This information currently can not be determined inside the widget's
template.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/048.bebaf88df8eeacb4bb27ec9164a185aa%40djangoproject.com.