Opened 15 years ago
Closed 13 years ago
#12073 closed New feature (fixed)
AdminDateWidget and AdminTimeWidget not passing though additional attrs
Reported by: | elliss | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | widgets date time calendar |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
Suggest a change to allow additional user-defined attributes to be passed though. currently they're passed in but not though:
CURRENT:
class AdminDateWidget(forms.TextInput): class Media: js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js", settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js") def __init__(self, attrs={}): super(AdminDateWidget, self).__init__(attrs={'class': 'vDateField', 'size': '10'}) class AdminTimeWidget(forms.TextInput): class Media: js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js", settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js") def __init__(self, attrs={}): super(AdminTimeWidget, self).__init__(attrs={'class': 'vTimeField', 'size': '8'})
SUGGESTED:
class AdminDateWidget(forms.TextInput): class Media: js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js", settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js") def __init__(self, attrs={}): attrs.update({'class': 'vDateField', 'size': '10'}) super(AdminDateWidget, self).__init__(attrs=attrs) class AdminTimeWidget(forms.TextInput): class Media: js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js", settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js") def __init__(self, attrs={}): attrs.update({'class': 'vTimeField', 'size': '8'}) super(AdminTimeWidget, self).__init__(attrs=attrs)
Attachments (1)
Change History (8)
comment:1 by , 15 years ago
Description: | modified (diff) |
---|
comment:2 by , 15 years ago
milestone: | → 1.2 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 15 years ago
milestone: | 1.2 |
---|
1.2 is feature-frozen, moving this feature request off the milestone.
comment:4 by , 14 years ago
attrs.update() is maybe too simple - that still wouldn't allow to change (or just add) a CSS class or change the size
comment:5 by , 14 years ago
Easy pickings: | unset |
---|---|
Has patch: | set |
Needs tests: | set |
Patch needs improvement: | set |
Severity: | → Normal |
Type: | → New feature |
comment:6 by , 13 years ago
Easy pickings: | set |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
UI/UX: | unset |
Version: | 1.0 → SVN |
The attached patch allows passing attrs into AdminDateWidget and AdminTimeWidget. Added a test too.
Note:
See TracTickets
for help on using tickets.
Fixed formatting. Please use WikiFormatting and the preview button.