summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2008-08-25 19:09:44 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2008-08-25 19:09:44 +0000
commitcbd574881c48e095b118031c850367f86b597a2e (patch)
treebf7ab44fa49b27c462877791a0611eb03b9da7a9 /django/forms/widgets.py
parent7e06b69a3d1e1cdfef625bdf96f97ca5eb0eed74 (diff)
Updated `TimeInput` changes from [8491] to allow time widgets to be used with unicode values. Fixes #7499.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 2e01634571..4f4d912c04 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -16,6 +16,7 @@ from django.utils.translation import ugettext
from django.utils.encoding import StrAndUnicode, force_unicode
from django.utils.safestring import mark_safe
from django.utils import datetime_safe
+from datetime import time
from util import flatatt
from urlparse import urljoin
@@ -307,7 +308,7 @@ class TimeInput(Input):
def render(self, name, value, attrs=None):
if value is None:
value = ''
- elif hasattr(value, 'replace'):
+ elif isinstance(value, time):
value = value.replace(microsecond=0)
return super(TimeInput, self).render(name, value, attrs)