Clone # 2
Distance between two fragments = 2
Clone size = 36
Source file "django/forms/widgets.py" The first line is 291 | Source file "django/forms/widgets.py" The first line is 314 | |
class DateInput(Input): input_type = 'text' format = None def __init__(self, attrs=None, format=None): super(DateInput, self).__init__(attrs) if format: self.format = format def _format_value(self, value): if value is None: return '' elif hasattr(value, 'strftime'): return formats.localize_input(value, self.format) return value def render(self, name, value, attrs=None): value = self._format_value(value) return super(DateInput, self).render(name, value, attrs) def _has_changed(self, initial, data): return super(DateInput, self)._has_changed(self._format_value(initial), data) |
class DateTimeInput(Input): input_type = 'text' format = None def __init__(self, attrs=None, format=None): super(DateTimeInput, self).__init__(attrs) if format: self.format = format def _format_value(self, value): if value is None: return '' elif hasattr(value, 'strftime'): return formats.localize_input(value, self.format) return value def render(self, name, value, attrs=None): value = self._format_value(value) return super(DateTimeInput, self).render(name, value, attrs) def _has_changed(self, initial, data): return super(DateTimeInput, self)._has_changed(self._format_value(initial), data) |
|
class DateTimeInput(Input): input_type = 'text' format = None def __init__(self, attrs=None, format=None): super(DateTimeInput, self).__init__(attrs) if format: self.format = format def _format_value(self, value): if value is None: return '' elif hasattr(value, 'strftime'): return formats.localize_input(value, self.format) return value def render(self, name, value, attrs=None): value = self._format_value(value) return super(DateTimeInput, self).render(name, value, attrs) def _has_changed(self, initial, data): return super(DateTimeInput, self)._has_changed(self._format_value(initial), data) |
class TimeInput(Input): input_type = 'text' format = None def __init__(self, attrs=None, format=None): super(TimeInput, self).__init__(attrs) if format: self.format = format def _format_value(self, value): if value is None: return '' elif hasattr(value, 'strftime'): return formats.localize_input(value, self.format) return value def render(self, name, value, attrs=None): value = self._format_value(value) return super(TimeInput, self).render(name, value, attrs) def _has_changed(self, initial, data): return super(TimeInput, self)._has_changed(self._format_value(initial), data) |