diff --git a/chrono/manager/widgets.py b/chrono/manager/widgets.py index b8eb9998..e7247628 100644 --- a/chrono/manager/widgets.py +++ b/chrono/manager/widgets.py @@ -130,27 +130,18 @@ class DateTimeWidget(PickerWidgetMixin, DateTimeInput): super(DateTimeWidget, self).__init__(attrs, options, usel10n) -class TimeWidget(PickerWidgetMixin, TimeInput): +class TimeWidget(TimeInput): """ - TimeWidget is the corresponding widget for Time field, it renders only the time section of - datetime picker. + TimeWidget is a widget for time selection, it uses the HTML5 "time" + input type and has a bit of a fallback mechanism with the presence + of the pattern attribute in case a standard text input is used. """ + input_type = 'time' - format_name = 'TIME_INPUT_FORMATS' - glyphicon = 'glyphicon-time' - - def __init__(self, attrs=None, options=None, usel10n=None): - - if options is None: - options = {} - - # Set the default options to show only the timepicker object - options['startView'] = options.get('startView', 1) - options['minView'] = options.get('minView', 0) - options['maxView'] = options.get('maxView', 1) - options['format'] = options.get('format', 'hh:ii') - - super(TimeWidget, self).__init__(attrs, options, usel10n) + def __init__(self, **kwargs): + super(TimeWidget, self).__init__(**kwargs) + self.attrs['step'] = '300' # 5 minutes + self.attrs['pattern'] = '[0-9]{2}:[0-9]{2}' class WeekdaysWidget(SelectMultiple):