mirror of
https://github.com/django/django.git
synced 2025-07-24 21:54:14 +00:00
More removal of poorly legible constructs to workaround Python 2.4 shortcomings.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16363 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
0e03a504bf
commit
c43d15b3b3
5 changed files with 12 additions and 17 deletions
|
@ -4,7 +4,6 @@ HTML Widget classes
|
|||
|
||||
import copy
|
||||
import datetime
|
||||
import time
|
||||
from itertools import chain
|
||||
from urlparse import urljoin
|
||||
from util import flatatt
|
||||
|
@ -397,7 +396,7 @@ class DateInput(Input):
|
|||
# necessarily the format used for this widget. Attempt to convert it.
|
||||
try:
|
||||
input_format = formats.get_format('DATE_INPUT_FORMATS')[0]
|
||||
initial = datetime.date(*time.strptime(initial, input_format)[:3])
|
||||
initial = datetime.datetime.strptime(initial, input_format).date()
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
return super(DateInput, self)._has_changed(self._format_value(initial), data)
|
||||
|
@ -429,7 +428,7 @@ class DateTimeInput(Input):
|
|||
# necessarily the format used for this widget. Attempt to convert it.
|
||||
try:
|
||||
input_format = formats.get_format('DATETIME_INPUT_FORMATS')[0]
|
||||
initial = datetime.datetime(*time.strptime(initial, input_format)[:6])
|
||||
initial = datetime.datetime.strptime(initial, input_format)
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
return super(DateTimeInput, self)._has_changed(self._format_value(initial), data)
|
||||
|
@ -460,7 +459,7 @@ class TimeInput(Input):
|
|||
# necessarily the format used for this widget. Attempt to convert it.
|
||||
try:
|
||||
input_format = formats.get_format('TIME_INPUT_FORMATS')[0]
|
||||
initial = datetime.time(*time.strptime(initial, input_format)[3:6])
|
||||
initial = datetime.datetime.strptime(initial, input_format).time()
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
return super(TimeInput, self)._has_changed(self._format_value(initial), data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue