Opened 15 years ago

Last modified 13 years ago

#12073 closed

AdminDateWidget and AdminTimeWidget not passing though additional attrs — at Initial Version

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

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)

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top