Ticket #7656: patch_django_7656.20090209.diff

File patch_django_7656.20090209.diff, 1.2 KB (added by David Larlet, 16 years ago)

Patch against r9820, AdminTimeWidget inherit from TimeInput and not DateTimeInput

  • django/contrib/admin/widgets.py

     
    3939            (name, self.verbose_name.replace('"', '\\"'), int(self.is_stacked), settings.ADMIN_MEDIA_PREFIX))
    4040        return mark_safe(u''.join(output))
    4141
    42 class AdminDateWidget(forms.TextInput):
     42class AdminDateWidget(forms.DateTimeInput):
     43    format = getattr(settings, 'ADMIN_DATE_FORMAT', '%Y-%m-%d')
     44   
    4345    class Media:
    4446        js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js",
    4547              settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js")
    4648
    47     def __init__(self, attrs={}):
    48         super(AdminDateWidget, self).__init__(attrs={'class': 'vDateField', 'size': '10'})
     49    def __init__(self, attrs={}, format=None):
     50        super(AdminDateWidget, self).__init__(attrs={'class': 'vDateField', 'size': '10'}, format=format)
    4951
    50 class AdminTimeWidget(forms.TextInput):
     52class AdminTimeWidget(forms.TimeInput):
     53   
    5154    class Media:
    5255        js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js",
    5356              settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js")
Back to Top