summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorwdmgsm <wdmgsm@yahoo.com>2015-04-08 16:59:15 +0100
committerTim Graham <timograham@gmail.com>2015-05-06 07:13:00 -0400
commit4dcc6493418c78db07761180bf6265f5b2bbccbf (patch)
tree101576515e325d1a389e7bdbc2eec89638275ff9 /django
parent6123e6134fba627a49ad379edfc20ae0f73bc9ac (diff)
Fixed #24497 -- Added Widget.supports_microseconds attribute
Diffstat (limited to 'django')
-rw-r--r--django/forms/forms.py2
-rw-r--r--django/forms/widgets.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py
index c5b190bdf5..509709f084 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -620,7 +620,7 @@ class BoundField(object):
# If this is an auto-generated default date, nix the
# microseconds for standardized handling. See #22502.
if (isinstance(data, (datetime.datetime, datetime.time)) and
- not getattr(self.field.widget, 'supports_microseconds', True)):
+ not self.field.widget.supports_microseconds):
data = data.replace(microsecond=0)
self._initial_value = data
else:
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index de6f8490eb..24d2dc87a4 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -180,6 +180,7 @@ class Widget(six.with_metaclass(MediaDefiningClass)):
needs_multipart_form = False # Determines does this widget need multipart form
is_localized = False
is_required = False
+ supports_microseconds = True
def __init__(self, attrs=None):
if attrs is not None: