| 13 | DEFAULT_DATE_INPUT_FORMATS = ( |
| 14 | '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06' |
| 15 | '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006' |
| 16 | '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006' |
| 17 | '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006' |
| 18 | '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006' |
| 19 | ) |
| 20 | |
| 21 | DEFAULT_DATETIME_INPUT_FORMATS = ( |
| 22 | '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' |
| 23 | '%Y-%m-%d %H:%M', # '2006-10-25 14:30' |
| 24 | '%Y-%m-%d', # '2006-10-25' |
| 25 | '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' |
| 26 | '%d/%m/%Y %H:%M', # '25/10/2006 14:30' |
| 27 | '%d/%m/%Y', # '25/10/2006' |
| 28 | '%d/%m/%y %H:%M:%S', # '25/10/06 14:30:59' |
| 29 | '%d/%m/%y %H:%M', # '25/10/06 14:30' |
| 30 | '%d/%m/%y', # '25/10/06' |
| 31 | ) |
| 32 | |
| 64 | |
| 65 | class AUDateField(DateField): |
| 66 | """ |
| 67 | A date input field which uses Australian date input formats by default. |
| 68 | """ |
| 69 | def __init__(self, input_formats=None, *args, **kwargs): |
| 70 | input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS |
| 71 | super(AUDateField, self).__init__(input_formats=input_formats, *args, **kwargs) |
| 72 | |
| 73 | class AUDateTimeField(DateTimeField): |
| 74 | """ |
| 75 | A date and time input field which uses Australian date and time input |
| 76 | formats by default. |
| 77 | """ |
| 78 | def __init__(self, input_formats=None, *args, **kwargs): |
| 79 | input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS |
| 80 | super(AUDateTimeField, self).__init__(input_formats=input_formats, *args, **kwargs) |