Ticket #7656: admin_widgets.diff

File admin_widgets.diff, 1.1 KB (added by Alex, 7 years ago)

Updates admin widgets to subclass DateTimeInput

  • django/contrib/admin/widgets.py

    diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
    index 4ae8889..be4a937 100644
    a b class FilteredSelectMultiple(forms.SelectMultiple): 
    3636            (name, self.verbose_name.replace('"', '\\"'), int(self.is_stacked), settings.ADMIN_MEDIA_PREFIX))
    3737        return mark_safe(u''.join(output))
    3838
    39 class AdminDateWidget(forms.TextInput):
     39class AdminDateWidget(forms.DateTimeInput):
     40    format = '%Y-%m-%d'
     41   
    4042    class Media:
    4143        js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js",
    4244              settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js")
    class AdminDateWidget(forms.TextInput): 
    4446    def __init__(self, attrs={}):
    4547        super(AdminDateWidget, self).__init__(attrs={'class': 'vDateField', 'size': '10'})
    4648
    47 class AdminTimeWidget(forms.TextInput):
     49class AdminTimeWidget(forms.DateTimeInput):
     50    format = '%H:%M:%S'
     51   
    4852    class Media:
    4953        js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js",
    5054              settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js")
Back to Top