Re: [Django] #34034: Adding a class on ChoiceWidget subwidgets is excessively difficult

32 views
Skip to first unread message

Django

unread,
Sep 28, 2022, 8:48:26 AM9/28/22
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by Claude Paroz):

I'm not yet sure about the implementation (didn't find time until now),
but basically, we should be able to handle the following use cases:
- attrs for parent widget, not on subwidgets (already OK with
`option_inherits_attrs` set to `False`)
- same attrs for parent widget AND subwidgets (already OK with
`option_inherits_attrs` set to `True`)
- attrs for subwidgets but NOT for parent widget (<-- TODO)

Ideally I would like to be able to do that without subclassing, e.g. by
`Widget(attrs={...}, option_attrs={...})`. I guess experiments will tell
if it's doable wrt option attrs inheritance.

--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 25, 2022, 1:33:42 PM10/25/22
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by David Smith):

Seems a reasonable suggestion to me.

One other thought I had was about using templates. A custom template could
be provided to `option_template_name` or
`"django/forms/widgets/select_option.html"` could be overridden. This may
help to avoid `Widget(attrs={...}, option_attrs={...})` each time this
type of widget is used in a project?

--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:5>

Django

unread,
Oct 25, 2022, 3:50:38 PM10/25/22
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by Claude Paroz):

The problem with templates is that it's also very difficult to add
classes, as they may conflict with other classes already present in
`attrs`. If there was a mean to complement widget/subwidget classes from
`attrs` with custom classes, then templates could be a viable solution.

--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:6>

Django

unread,
Jun 2, 2023, 6:42:04 AM6/2/23
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Kees Hink
Type: New feature | Status: assigned

Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+-------------------------------------
Changes (by Kees Hink):

* owner: nobody => Kees Hink
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:7>

Django

unread,
Jun 2, 2023, 7:49:06 AM6/2/23
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Kees Hink
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+-------------------------------------
Changes (by Kees Hink):

* has_patch: 0 => 1


Comment:

https://github.com/django/django/pull/16929

--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:8>

Django

unread,
Jun 2, 2023, 12:23:41 PM6/2/23
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+-------------------------------------
Reporter: Claude Paroz | Owner: Kees Hink
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:9>

Django

unread,
Oct 4, 2023, 7:53:38 AM10/4/23
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: (none)

Type: New feature | Status: new
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* owner: Kees Hink => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:10>

Django

unread,
Jan 9, 2024, 6:35:50 AM1/9/24
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: Mariana

Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Mariana):

* owner: (none) => Mariana


* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:11>

Django

unread,
Jun 11, 2024, 4:57:45 AM6/11/24
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: Mariana
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Mariana):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:12>

Django

unread,
Jul 23, 2024, 5:30:37 AM7/23/24
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: Mariana
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:13>

Django

unread,
Oct 31, 2024, 11:02:13 AM10/31/24
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: Mariana
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Mariana):

* needs_better_patch: 1 => 0

Comment:

[https://github.com/django/django/pull/18146 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:14>

Django

unread,
Nov 4, 2024, 9:09:19 AM11/4/24
to django-...@googlegroups.com
#34034: Adding a class on ChoiceWidget subwidgets is excessively difficult
------------------------------+------------------------------------
Reporter: Claude Paroz | Owner: Mariana
Type: New feature | Status: assigned
Component: Forms | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Sarah Boyce):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/34034#comment:15>
Reply all
Reply to author
Forward
0 new messages