Code

Ticket #5027: widgets.diff

File widgets.diff, 592 bytes (added by robvdl, 6 years ago)

Cast value to a string, in case it was a datetime type

Line 
1--- /usr/lib/python2.5/site-packages/django/newforms/extras/widgets.py  2008-02-29 12:02:40.000000000 +1300
2+++ widgets.py  2008-03-01 17:41:13.286136419 +1300
3@@ -32,7 +32,7 @@ class SelectDateWidget(Widget):
4 
5     def render(self, name, value, attrs=None):
6         try:
7-            value = datetime.date(*map(int, value.split('-')))
8+            value = datetime.date(*map(int, str(value).split('-')))
9             year_val, month_val, day_val = value.year, value.month, value.day
10         except (AttributeError, TypeError, ValueError):
11             year_val = month_val = day_val = None