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.
Comment (by Claude Paroz):
Note that `form` is no longer in the context after #33134.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:1>
Comment (by Jacob Rief):
Well, in case of the label rendering context, the `form`-object is
accessible through the `field`. However, the widget rendering context
doesn't offer the `field`-object.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:2>
* cc: David Smith (added)
* type: Cleanup/optimization => New feature
* stage: Unreviewed => Accepted
Comment:
Tentatively accepted, this will require passing `field` to the
`Widget.render()`.
This is not strictly related with
456466d932830b096d39806e291fe23ec5ed38d5.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:3>
* owner: nobody => Jacob Rief
* status: new => assigned
* has_patch: 0 => 1
Comment:
Here is a draft pull request to implement this:
https://github.com/django/django/pull/14955
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:4>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:5>
Comment (by David Smith):
I wonder about creating a circular context here. A field has a widget and
you can access the field from the context of the widget and so on. See
#33134 for a recent bug with field labels.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:6>
* needs_better_patch: 1 => 0
Comment:
This should be review again.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:7>
* cc: Sarah Boyce (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:8>
Comment (by Carlton Gibson):
As per David's comment on the PR here, we should resolve #34077 first, to
see if that gives everything needed here.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:9>
* needs_better_patch: 0 => 1
Comment:
Marking as "Patch needs improvement" as this is waiting for #34077.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:10>
Comment (by Mariusz Felisiak):
Jacob, Have you seen cad376f844c7bdeeee7607a7c0ea8ae52061309b? Do we still
need this change?
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:11>
* status: assigned => closed
* needs_better_patch: 1 => 0
* has_patch: 1 => 0
* resolution: => wontfix
* stage: Accepted => Unreviewed
Comment:
I think it's no longer needed after
cad376f844c7bdeeee7607a7c0ea8ae52061309b.
--
Ticket URL: <https://code.djangoproject.com/ticket/33166#comment:12>