Opened 10 years ago
Closed 10 years ago
#25124 closed Cleanup/optimization (fixed)
Make it easier to use a custom Select widget subclass in a SelectDateWidget
| Reported by: | George Brocklehurst | Owned by: | nobody |
|---|---|---|---|
| Component: | Forms | Version: | 1.8 |
| Severity: | Normal | Keywords: | forms widgets SelectDateWidget |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
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
Change History (3)
comment:1 by , 10 years ago
| Description: | modified (diff) |
|---|---|
| Has patch: | set |
comment:2 by , 10 years ago
| Triage Stage: | Unreviewed → Ready for checkin |
|---|
comment:3 by , 10 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
In 48af591: