Ticket #7656: patch_django_7656.20090207.diff

File patch_django_7656.20090207.diff, 1.6 KB (added by david, 6 years ago)

Update the patch against r9814 + a couple of fixes

  • 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.DateTimeInput):
     53    format = getattr(settings, 'ADMIN_TIME_FORMAT', '%H:%M:%S')
     54   
    5155    class Media:
    5256        js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js",
    5357              settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js")
    5458
    55     def __init__(self, attrs={}):
    56         super(AdminTimeWidget, self).__init__(attrs={'class': 'vTimeField', 'size': '8'})
     59    def __init__(self, attrs={}, format=None):
     60        super(AdminTimeWidget, self).__init__(attrs={'class': 'vTimeField', 'size': '8'}, format=format)
    5761
    5862class AdminSplitDateTime(forms.SplitDateTimeWidget):
    5963    """
Back to Top