mirror of
https://github.com/django/django.git
synced 2025-07-24 21:54:14 +00:00
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
This commit is contained in:
parent
7e06b69a3d
commit
cbd574881c
2 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue