Ticket #14718: splitdatetimewidget.2.patch

File splitdatetimewidget.2.patch, 1.1 KB (added by slink <gabor@…>, 14 years ago)
  • django/forms/widgets.py

     
    831831    date_format = DateInput.format
    832832    time_format = TimeInput.format
    833833
    834     def __init__(self, attrs=None, date_format=None, time_format=None):
    835         widgets = (DateInput(attrs=attrs, format=date_format),
    836                    TimeInput(attrs=attrs, format=time_format))
     834    def __init__(self, attrs=None, date_format=None, time_format=None, date_attrs=None, time_attrs=None):
     835        if attrs:
     836            if date_attrs:
     837                date_attrs.update(attrs)
     838            else:
     839                date_attrs = attrs
     840            if time_attrs:
     841                time_attrs.update(attrs)
     842            else:
     843                time_attrs = attrs
     844        widgets = (DateInput(attrs=date_attrs, format=date_format),
     845                   TimeInput(attrs=time_attrs, format=time_format))
    837846        super(SplitDateTimeWidget, self).__init__(widgets, attrs)
    838847
    839848    def decompress(self, value):
Back to Top