#34837: CheckboxSelectMultiple.attrs should accept more than "id" and "class"
-------------------------------------------+------------------------
               Reporter:  HarryKane        |          Owner:  nobody
                   Type:  New feature      |         Status:  new
              Component:  Template system  |        Version:  4.2
               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                |
-------------------------------------------+------------------------
 In a Form I want to modify the widget of a field, like

 {{{
 "field": django.forms.CheckboxSelectMultiple(
   attrs={
     "id": "my-id",
     "class": "foo"
     "hx-get": "/some/path/,
     "hx-target": "#target-id",
     "hx-trigger": "load",
   }
 )
 }}}
 but it just renders
 {{{
 <div id="my-id" class="foo">...</div>
 }}}
 instead of
 {{{
 <div id="my-id" class="foo" hx-get="...", hx-target="...", "hx-
 trigger="...">...</div>
 }}}

 The reason seams to be, that the `django/forms/widets/multiple_input.html`
 renders only `id` and `class`
 {{{
 {% with id=widget.attrs.id %}<div{% if id %} id="{{ id }}"{% endif %}{% if
 widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}>{% for
 group, options, index in widget.optgroups %}{% if group %}
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34837>
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/0107018a8e8e5f7f-146a48ef-e17a-4d06-9daa-03cbdbe828ee-000000%40eu-central-1.amazonses.com.

Reply via email to