summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2011-11-06 00:31:06 +0000
committerJulien Phalip <jphalip@gmail.com>2011-11-06 00:31:06 +0000
commitb2948d81798e78e0b3bcb016bd4efa4d66bc5d8e (patch)
treef3dc300ceb774d3ff510dd59157b1aeed6a710a8 /django/forms
parentaf7688dbec67ca7123aab7e8ead639bb7dbbced1 (diff)
Fixed #17165 -- Fixed `SelectDateWidget._has_changed()` to work correctly with a localized date format.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17071 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/extras/widgets.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/forms/extras/widgets.py b/django/forms/extras/widgets.py
index 51455780f5..4fb4869e68 100644
--- a/django/forms/extras/widgets.py
+++ b/django/forms/extras/widgets.py
@@ -134,3 +134,8 @@ class SelectDateWidget(Widget):
s = Select(choices=choices)
select_html = s.render(field % name, val, local_attrs)
return select_html
+
+ def _has_changed(self, initial, data):
+ input_format = get_format('DATE_INPUT_FORMATS')[0]
+ data = datetime_safe.datetime.strptime(data, input_format).date()
+ return super(SelectDateWidget, self)._has_changed(initial, data) \ No newline at end of file