# HG changeset patch # User Denis Laxalde # Date 1562674830 -7200 # Node ID 30a98fd4ce31456192a75fb403b267f5f1ae6b6c # Parent 2c7499bc675b39331316df3b9a34cc0b98d1f492 [web] Make the time separator configurable in JQueryDateTimePicker We add a "separator" argument to JQueryDateTimePicker which will be used when creating the underlying JQueryTimePicker instance so that the user can control how time is displayed by the widget. This is very similar to the "timesteps" argument that's already present. diff -r 2c7499bc675b -r 30a98fd4ce31 cubicweb/web/formwidgets.py --- a/cubicweb/web/formwidgets.py Wed Jun 26 13:19:30 2019 +0200 +++ b/cubicweb/web/formwidgets.py Tue Jul 09 14:20:30 2019 +0200 @@ -755,10 +755,11 @@ :class:`JQueryTimePicker` widgets to define a date and time picker. Will return the date and time as python datetime instance. """ - def __init__(self, initialtime=None, timesteps=15, **kwargs): + def __init__(self, initialtime=None, timesteps=15, separator=u':', **kwargs): super(JQueryDateTimePicker, self).__init__(**kwargs) self.initialtime = initialtime self.timesteps = timesteps + self.separator = separator def _render(self, form, field, renderer): """render the widget for the given `field` of `form`. @@ -784,7 +785,7 @@ timestr = req.format_time(self.initialtime) datepicker = JQueryDatePicker(datestr=datestr, suffix='date') timepicker = JQueryTimePicker(timestr=timestr, timesteps=self.timesteps, - suffix='time') + separator=self.separator, suffix='time') return u'
%s%s
' % (field.dom_id(form), datepicker.render(form, field, renderer), timepicker.render(form, field, renderer))