diff -r 365044b9174e forms/widgets.py
a
|
b
|
|
302 | 302 | |
303 | 303 | class DateInput(Input): |
304 | 304 | input_type = 'text' |
305 | | format = '%Y-%m-%d' # '2006-10-25' |
| 305 | format = formats.get_format('DATE_INPUT_FORMATS')[0] # or '%Y-%m-%d' # '2006-10-25' |
306 | 306 | |
307 | 307 | def __init__(self, attrs=None, format=None): |
308 | 308 | super(DateInput, self).__init__(attrs) |
… |
… |
|
322 | 322 | # formatted by HiddenInput using formats.localize_input, which is not |
323 | 323 | # necessarily the format used for this widget. Attempt to convert it. |
324 | 324 | try: |
325 | | input_format = formats.get_format('DATE_INPUT_FORMATS')[0] |
| 325 | input_format = self.format |
326 | 326 | initial = datetime.date(*time.strptime(initial, input_format)[:3]) |
327 | 327 | except (TypeError, ValueError): |
328 | 328 | pass |
… |
… |
|
330 | 330 | |
331 | 331 | class DateTimeInput(Input): |
332 | 332 | input_type = 'text' |
333 | | format = '%Y-%m-%d %H:%M:%S' # '2006-10-25 14:30:59' |
| 333 | format = formats.get_format('DATETIME_INPUT_FORMATS')[0] #'%Y-%m-%d %H:%M:%S' # '2006-10-25 14:30:59' |
334 | 334 | |
335 | 335 | def __init__(self, attrs=None, format=None): |
336 | 336 | super(DateTimeInput, self).__init__(attrs) |
… |
… |
|
350 | 350 | # formatted by HiddenInput using formats.localize_input, which is not |
351 | 351 | # necessarily the format used for this widget. Attempt to convert it. |
352 | 352 | try: |
353 | | input_format = formats.get_format('DATETIME_INPUT_FORMATS')[0] |
| 353 | input_format = self.format |
354 | 354 | initial = datetime.datetime(*time.strptime(initial, input_format)[:6]) |
355 | 355 | except (TypeError, ValueError): |
356 | 356 | pass |
… |
… |
|
358 | 358 | |
359 | 359 | class TimeInput(Input): |
360 | 360 | input_type = 'text' |
361 | | format = '%H:%M:%S' # '14:30:59' |
| 361 | format = formats.get_format('TIME_INPUT_FORMATS')[0] #'%H:%M:%S' # '14:30:59' |
362 | 362 | |
363 | 363 | def __init__(self, attrs=None, format=None): |
364 | 364 | super(TimeInput, self).__init__(attrs) |
… |
… |
|
377 | 377 | # formatted by HiddenInput using formats.localize_input, which is not |
378 | 378 | # necessarily the format used for this widget. Attempt to convert it. |
379 | 379 | try: |
380 | | input_format = formats.get_format('TIME_INPUT_FORMATS')[0] |
| 380 | input_format = self.format |
381 | 381 | initial = datetime.time(*time.strptime(initial, input_format)[3:6]) |
382 | 382 | except (TypeError, ValueError): |
383 | 383 | pass |