[Django] #25124: Make it easier to use a custom Select widget subclass in a SelectDateWidget

14 views
Skip to first unread message

Django

unread,
Jul 14, 2015, 10:53:27 PM7/14/15
to django-...@googlegroups.com
#25124: Make it easier to use a custom Select widget subclass in a SelectDateWidget
-------------------------------------+-------------------------------------
Reporter: georgebrock | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Keywords: forms widgets
| SelectDateWidget
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
The current implementation of `SelectDateWidget` always uses the `Select`
widget for the individual year, month, and day selects. If we moved the
reference to `Select` to an attribute of the `SelectDateWidget` class, it
would be easier to override.

Sometimes it's useful to use a different widget, e.g. in a recent project
I wanted to use a `Select` subclass that wrapped the rendered widget in a
`<div>` for styling reasons. This involved subclassing `SelectDateWidget`
and duplicating the whole `SelectDateWidget.create_select` method, which
does quite a lot of work, just to change one class name.

I'm happy to put together a pull request for this, but the contributing
guidelines said that PRs without Trac tickets would be closed, so here's
the Trac ticket.

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

Django

unread,
Jul 14, 2015, 11:01:27 PM7/14/15
to django-...@googlegroups.com
#25124: Make it easier to use a custom Select widget subclass in a SelectDateWidget
-------------------------------------+-------------------------------------
Reporter: georgebrock | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Resolution:
Keywords: forms widgets | Triage Stage:
SelectDateWidget | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by georgebrock):

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


Old description:

> The current implementation of `SelectDateWidget` always uses the `Select`
> widget for the individual year, month, and day selects. If we moved the
> reference to `Select` to an attribute of the `SelectDateWidget` class, it
> would be easier to override.
>
> Sometimes it's useful to use a different widget, e.g. in a recent project
> I wanted to use a `Select` subclass that wrapped the rendered widget in a
> `<div>` for styling reasons. This involved subclassing `SelectDateWidget`
> and duplicating the whole `SelectDateWidget.create_select` method, which
> does quite a lot of work, just to change one class name.
>
> I'm happy to put together a pull request for this, but the contributing
> guidelines said that PRs without Trac tickets would be closed, so here's
> the Trac ticket.

New description:

The current implementation of `SelectDateWidget` always uses the `Select`
widget for the individual year, month, and day selects. If we moved the
reference to `Select` to an attribute of the `SelectDateWidget` class, it
would be easier to override.

Sometimes it's useful to use a different widget, e.g. in a recent project
I wanted to use a `Select` subclass that wrapped the rendered widget in a
`<div>` for styling reasons. This involved subclassing `SelectDateWidget`
and duplicating the whole `SelectDateWidget.create_select` method, which
does quite a lot of work, just to change one class name.

Pull request: https://github.com/django/django/pull/4998

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25124#comment:1>

Django

unread,
Jul 15, 2015, 10:01:59 AM7/15/15
to django-...@googlegroups.com
#25124: Make it easier to use a custom Select widget subclass in a SelectDateWidget
-------------------------------------+-------------------------------------
Reporter: georgebrock | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Resolution:
Keywords: forms widgets | Triage Stage: Ready for
SelectDateWidget | checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/25124#comment:2>

Django

unread,
Jul 15, 2015, 10:26:32 AM7/15/15
to django-...@googlegroups.com
#25124: Make it easier to use a custom Select widget subclass in a SelectDateWidget
-------------------------------------+-------------------------------------
Reporter: georgebrock | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Forms | Version: 1.8
Severity: Normal | Resolution: fixed

Keywords: forms widgets | Triage Stage: Ready for
SelectDateWidget | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"48af591b2dd1f4c6b87558698f311dd7fe6dbbc0" 48af591]:
{{{
#!CommitTicketReference repository=""
revision="48af591b2dd1f4c6b87558698f311dd7fe6dbbc0"
Fixed #25124 -- Eased customization of SelectDateWidget subwidget.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25124#comment:3>

Reply all
Reply to author
Forward
0 new messages