Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

19015 #440

Closed
wants to merge 2 commits into from

2 participants

Claude Paroz Simon Charette
Claude Paroz
Owner

Automatically add ISO input formats to all localized input formats.

added some commits October 13, 2012
Claude Paroz Fixed #19015 -- Add ISO input formats to all formats ef6d08b
Claude Paroz Removed ISO formats from localized formats.py
ISO formats are automatically appended to the list of input
formats. Kept only when it is specified in first position, as it
has a special meaning in localize_input.
38dfe6a
Simon Charette

Maybe we should note that we kept (TIME_INPUT) ISO formats as they are in first position here too.

Owner

Thanks, already done on my local branch.

Claude Paroz
Owner

Committed in 90d3af3

Claude Paroz claudep closed this December 01, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Oct 13, 2012
Claude Paroz Fixed #19015 -- Add ISO input formats to all formats ef6d08b
Claude Paroz Removed ISO formats from localized formats.py
ISO formats are automatically appended to the list of input
formats. Kept only when it is specified in first position, as it
has a special meaning in localize_input.
38dfe6a
This page is out of date. Refresh to see the latest.

Showing 34 changed files with 42 additions and 173 deletions. Show diff stats Hide diff stats

  1. 4  django/conf/locale/ca/formats.py
  2. 8  django/conf/locale/cs/formats.py
  3. 4  django/conf/locale/da/formats.py
  4. 8  django/conf/locale/de/formats.py
  5. 8  django/conf/locale/de_CH/formats.py
  6. 5  django/conf/locale/en/formats.py
  7. 5  django/conf/locale/en_GB/formats.py
  8. 4  django/conf/locale/es/formats.py
  9. 4  django/conf/locale/es_AR/formats.py
  10. 3  django/conf/locale/es_MX/formats.py
  11. 3  django/conf/locale/es_NI/formats.py
  12. 8  django/conf/locale/fr/formats.py
  13. 5  django/conf/locale/hr/formats.py
  14. 4  django/conf/locale/it/formats.py
  15. 5  django/conf/locale/ka/formats.py
  16. 1  django/conf/locale/ko/formats.py
  17. 1  django/conf/locale/lv/formats.py
  18. 9  django/conf/locale/mk/formats.py
  19. 5  django/conf/locale/ml/formats.py
  20. 7  django/conf/locale/nb/formats.py
  21. 6  django/conf/locale/nl/formats.py
  22. 6  django/conf/locale/nn/formats.py
  23. 9  django/conf/locale/pl/formats.py
  24. 5  django/conf/locale/pt/formats.py
  25. 9  django/conf/locale/pt_BR/formats.py
  26. 8  django/conf/locale/ru/formats.py
  27. 9  django/conf/locale/sk/formats.py
  28. 5  django/conf/locale/sl/formats.py
  29. 8  django/conf/locale/sr/formats.py
  30. 8  django/conf/locale/sr_Latn/formats.py
  31. 5  django/conf/locale/sv/formats.py
  32. 9  django/conf/locale/tr/formats.py
  33. 16  django/utils/formats.py
  34. 11  tests/regressiontests/forms/tests/input_formats.py
4  django/conf/locale/ca/formats.py
@@ -19,10 +19,6 @@
19 19
     # '31/12/2009', '31/12/09'
20 20
     '%d/%m/%Y', '%d/%m/%y'
21 21
 )
22  
-TIME_INPUT_FORMATS = (
23  
-    # '14:30:59', '14:30'
24  
-    '%H:%M:%S', '%H:%M'
25  
-)
26 22
 DATETIME_INPUT_FORMATS = (
27 23
     '%d/%m/%Y %H:%M:%S',
28 24
     '%d/%m/%Y %H:%M',
8  django/conf/locale/cs/formats.py
@@ -18,20 +18,12 @@
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
19 19
 DATE_INPUT_FORMATS = (
20 20
     '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
21  
-    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
22 21
     # '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
23 22
 )
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S', # '14:30:59'
26  
-    '%H:%M',    # '14:30'
27  
-)
28 23
 DATETIME_INPUT_FORMATS = (
29 24
     '%d.%m.%Y %H:%M:%S',    # '25.10.2006 14:30:59'
30 25
     '%d.%m.%Y %H:%M',       # '25.10.2006 14:30'
31 26
     '%d.%m.%Y',             # '25.10.2006'
32  
-    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
33  
-    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
34  
-    '%Y-%m-%d',             # '2006-10-25'
35 27
 )
36 28
 DECIMAL_SEPARATOR = ','
37 29
 THOUSAND_SEPARATOR = '\xa0' # non-breaking space
4  django/conf/locale/da/formats.py
@@ -18,10 +18,6 @@
18 18
 DATE_INPUT_FORMATS = (
19 19
     '%d.%m.%Y',                         # '25.10.2006'
20 20
 )
21  
-TIME_INPUT_FORMATS = (
22  
-    '%H:%M:%S',                         # '14:30:59'
23  
-    '%H:%M',                            # '14:30'
24  
-)
25 21
 DATETIME_INPUT_FORMATS = (
26 22
     '%d.%m.%Y %H:%M:%S',                # '25.10.2006 14:30:59'
27 23
     '%d.%m.%Y %H:%M',                   # '25.10.2006 14:30'
8  django/conf/locale/de/formats.py
@@ -17,20 +17,12 @@
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
18 18
 DATE_INPUT_FORMATS = (
19 19
     '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
20  
-    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
21 20
     # '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
22 21
 )
23  
-TIME_INPUT_FORMATS = (
24  
-    '%H:%M:%S', # '14:30:59'
25  
-    '%H:%M',    # '14:30'
26  
-)
27 22
 DATETIME_INPUT_FORMATS = (
28 23
     '%d.%m.%Y %H:%M:%S',    # '25.10.2006 14:30:59'
29 24
     '%d.%m.%Y %H:%M',       # '25.10.2006 14:30'
30 25
     '%d.%m.%Y',             # '25.10.2006'
31  
-    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
32  
-    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
33  
-    '%Y-%m-%d',             # '2006-10-25'
34 26
 )
35 27
 DECIMAL_SEPARATOR = ','
36 28
 THOUSAND_SEPARATOR = '.'
8  django/conf/locale/de_CH/formats.py
@@ -19,20 +19,12 @@
19 19
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
20 20
 DATE_INPUT_FORMATS = (
21 21
     '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
22  
-    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
23 22
     # '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
24 23
 )
25  
-TIME_INPUT_FORMATS = (
26  
-    '%H:%M:%S', # '14:30:59'
27  
-    '%H:%M',    # '14:30'
28  
-)
29 24
 DATETIME_INPUT_FORMATS = (
30 25
     '%d.%m.%Y %H:%M:%S',    # '25.10.2006 14:30:59'
31 26
     '%d.%m.%Y %H:%M',       # '25.10.2006 14:30'
32 27
     '%d.%m.%Y',             # '25.10.2006'
33  
-    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
34  
-    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
35  
-    '%Y-%m-%d',             # '2006-10-25'
36 28
 )
37 29
 
38 30
 # these are the separators for non-monetary numbers. For monetary numbers,
5  django/conf/locale/en/formats.py
@@ -15,6 +15,7 @@
15 15
 
16 16
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  18
+# Kept ISO formats as they are in first position
18 19
 DATE_INPUT_FORMATS = (
19 20
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
20 21
     # '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
@@ -22,10 +23,6 @@
22 23
     # '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
23 24
     # '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
24 25
 )
25  
-TIME_INPUT_FORMATS = (
26  
-    '%H:%M:%S',     # '14:30:59'
27  
-    '%H:%M',        # '14:30'
28  
-)
29 26
 DATETIME_INPUT_FORMATS = (
30 27
     '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
31 28
     '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
5  django/conf/locale/en_GB/formats.py
@@ -17,16 +17,11 @@
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
18 18
 DATE_INPUT_FORMATS = (
19 19
     '%d/%m/%Y', '%d/%m/%y',             # '25/10/2006', '25/10/06'
20  
-    '%Y-%m-%d',                         # '2006-10-25'
21 20
     # '%b %d %Y', '%b %d, %Y',          # 'Oct 25 2006', 'Oct 25, 2006'
22 21
     # '%d %b %Y', '%d %b, %Y',          # '25 Oct 2006', '25 Oct, 2006'
23 22
     # '%B %d %Y', '%B %d, %Y',          # 'October 25 2006', 'October 25, 2006'
24 23
     # '%d %B %Y', '%d %B, %Y',          # '25 October 2006', '25 October, 2006'
25 24
 )
26  
-TIME_INPUT_FORMATS = (
27  
-    '%H:%M:%S',                         # '14:30:59'
28  
-    '%H:%M',                            # '14:30'
29  
-)
30 25
 DATETIME_INPUT_FORMATS = (
31 26
     '%Y-%m-%d %H:%M:%S',                # '2006-10-25 14:30:59'
32 27
     '%Y-%m-%d %H:%M',                   # '2006-10-25 14:30'
4  django/conf/locale/es/formats.py
@@ -19,10 +19,6 @@
19 19
     # '31/12/2009', '31/12/09'
20 20
     '%d/%m/%Y', '%d/%m/%y'
21 21
 )
22  
-TIME_INPUT_FORMATS = (
23  
-    # '14:30:59', '14:30'
24  
-    '%H:%M:%S', '%H:%M'
25  
-)
26 22
 DATETIME_INPUT_FORMATS = (
27 23
     '%d/%m/%Y %H:%M:%S',
28 24
     '%d/%m/%Y %H:%M',
4  django/conf/locale/es_AR/formats.py
@@ -19,10 +19,6 @@
19 19
     '%d/%m/%Y', # '31/12/2009'
20 20
     '%d/%m/%y', # '31/12/09'
21 21
 )
22  
-TIME_INPUT_FORMATS = (
23  
-    '%H:%M:%S', # '14:30:59'
24  
-    '%H:%M',    # '14:30'
25  
-)
26 22
 DATETIME_INPUT_FORMATS = (
27 23
     '%d/%m/%Y %H:%M:%S',
28 24
     '%d/%m/%Y %H:%M',
3  django/conf/locale/es_MX/formats.py
@@ -15,9 +15,6 @@
15 15
     '%d/%m/%Y', '%d/%m/%y',             # '25/10/2006', '25/10/06'
16 16
     '%Y%m%d',                           # '20061025'
17 17
 )
18  
-TIME_INPUT_FORMATS = (
19  
-    '%H:%M:%S', '%H:%M',		# '14:30:59', '14:30'
20  
-)
21 18
 DATETIME_INPUT_FORMATS = (
22 19
     '%d/%m/%Y %H:%M:%S',
23 20
     '%d/%m/%Y %H:%M',
3  django/conf/locale/es_NI/formats.py
@@ -15,9 +15,6 @@
15 15
     '%Y%m%d',                          	# '20061025'
16 16
 
17 17
 )
18  
-TIME_INPUT_FORMATS = (
19  
-    '%H:%M:%S', '%H:%M',		# '14:30:59', '14:30'
20  
-)
21 18
 DATETIME_INPUT_FORMATS = (
22 19
     '%d/%m/%Y %H:%M:%S',
23 20
     '%d/%m/%Y %H:%M',
8  django/conf/locale/fr/formats.py
@@ -19,13 +19,8 @@
19 19
 DATE_INPUT_FORMATS = (
20 20
     '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
21 21
     '%d.%m.%Y', '%d.%m.%y', # Swiss (fr_CH), '25.10.2006', '25.10.06'
22  
-    '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
23 22
     # '%d %B %Y', '%d %b %Y', # '25 octobre 2006', '25 oct. 2006'
24 23
 )
25  
-TIME_INPUT_FORMATS = (
26  
-    '%H:%M:%S', # '14:30:59'
27  
-    '%H:%M',    # '14:30'
28  
-)
29 24
 DATETIME_INPUT_FORMATS = (
30 25
     '%d/%m/%Y %H:%M:%S',    # '25/10/2006 14:30:59'
31 26
     '%d/%m/%Y %H:%M',       # '25/10/2006 14:30'
@@ -33,9 +28,6 @@
33 28
     '%d.%m.%Y %H:%M:%S',    # Swiss (fr_CH), '25.10.2006 14:30:59'
34 29
     '%d.%m.%Y %H:%M',       # Swiss (fr_CH), '25.10.2006 14:30'
35 30
     '%d.%m.%Y',             # Swiss (fr_CH), '25.10.2006'
36  
-    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
37  
-    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
38  
-    '%Y-%m-%d',             # '2006-10-25'
39 31
 )
40 32
 DECIMAL_SEPARATOR = ','
41 33
 THOUSAND_SEPARATOR = '\xa0' # non-breaking space
5  django/conf/locale/hr/formats.py
@@ -15,15 +15,12 @@
15 15
 
16 16
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  18
+# Kept ISO formats as they are in first position
18 19
 DATE_INPUT_FORMATS = (
19 20
     '%Y-%m-%d',                     # '2006-10-25'
20 21
     '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
21 22
     '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
22 23
 )
23  
-TIME_INPUT_FORMATS = (
24  
-    '%H:%M:%S',     # '14:30:59'
25  
-    '%H:%M',        # '14:30'
26  
-)
27 24
 DATETIME_INPUT_FORMATS = (
28 25
     '%Y-%m-%d %H:%M:%S',      # '2006-10-25 14:30:59'
29 26
     '%Y-%m-%d %H:%M',         # '2006-10-25 14:30'
4  django/conf/locale/it/formats.py
@@ -20,10 +20,6 @@
20 20
     '%d-%m-%Y', '%Y-%m-%d',  # '25-10-2006', '2008-10-25'
21 21
     '%d-%m-%y', '%d/%m/%y',  # '25-10-06', '25/10/06'
22 22
 )
23  
-TIME_INPUT_FORMATS = (
24  
-    '%H:%M:%S',     # '14:30:59'
25  
-    '%H:%M',        # '14:30'
26  
-)
27 23
 DATETIME_INPUT_FORMATS = (
28 24
     '%d/%m/%Y %H:%M:%S',     # '25/10/2006 14:30:59'
29 25
     '%d/%m/%Y %H:%M',        # '25/10/2006 14:30'
5  django/conf/locale/ka/formats.py
@@ -15,16 +15,13 @@
15 15
 
16 16
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  18
+# Kept ISO formats as they are in first position
18 19
 DATE_INPUT_FORMATS = (
19 20
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y',     # '2006-10-25', '10/25/2006', '10/25/06'
20 21
     # '%d %b %Y', '%d %b, %Y', '%d %b. %Y',   # '25 Oct 2006', '25 Oct, 2006', '25 Oct. 2006'
21 22
     # '%d %B %Y', '%d %B, %Y',                # '25 October 2006', '25 October, 2006'
22 23
     # '%d.%m.%Y', '%d.%m.%y',                 # '25.10.2006', '25.10.06'
23 24
 )
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S',     # '14:30:59'
26  
-    '%H:%M',        # '14:30'
27  
-)
28 25
 DATETIME_INPUT_FORMATS = (
29 26
     '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
30 27
     '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
1  django/conf/locale/ko/formats.py
@@ -16,6 +16,7 @@
16 16
 
17 17
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  19
+# Kept ISO formats as they are in first position
19 20
 DATE_INPUT_FORMATS = (
20 21
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
21 22
     # '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
1  django/conf/locale/lv/formats.py
@@ -16,6 +16,7 @@
16 16
 
17 17
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  19
+# Kept ISO formats as they are in first position
19 20
 DATE_INPUT_FORMATS = (
20 21
     '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
21 22
 )
9  django/conf/locale/mk/formats.py
@@ -18,12 +18,6 @@
18 18
 DATE_INPUT_FORMATS = (
19 19
     '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
20 20
     '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
21  
-    '%Y-%m-%d',                     # '2006-10-25'
22  
-)
23  
-
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S',     # '14:30:59'
26  
-    '%H:%M',        # '14:30'
27 21
 )
28 22
 
29 23
 DATETIME_INPUT_FORMATS = (
@@ -39,9 +33,6 @@
39 33
     '%d. %m. %y. %H:%M:%S',   # '25. 10. 06. 14:30:59'
40 34
     '%d. %m. %y. %H:%M',      # '25. 10. 06. 14:30'
41 35
     '%d. %m. %y.',            # '25. 10. 06.'
42  
-    '%Y-%m-%d %H:%M:%S',      # '2006-10-25 14:30:59'
43  
-    '%Y-%m-%d %H:%M',         # '2006-10-25 14:30'
44  
-    '%Y-%m-%d',               # '2006-10-25'
45 36
 )
46 37
 
47 38
 DECIMAL_SEPARATOR = ','
5  django/conf/locale/ml/formats.py
@@ -15,6 +15,7 @@
15 15
 
16 16
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  18
+# Kept ISO formats as they are in first position
18 19
 DATE_INPUT_FORMATS = (
19 20
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
20 21
     # '%b %d %Y', '%b %d, %Y',            # 'Oct 25 2006', 'Oct 25, 2006'
@@ -22,10 +23,6 @@
22 23
     # '%B %d %Y', '%B %d, %Y',            # 'October 25 2006', 'October 25, 2006'
23 24
     # '%d %B %Y', '%d %B, %Y',            # '25 October 2006', '25 October, 2006'
24 25
 )
25  
-TIME_INPUT_FORMATS = (
26  
-    '%H:%M:%S',     # '14:30:59'
27  
-    '%H:%M',        # '14:30'
28  
-)
29 26
 DATETIME_INPUT_FORMATS = (
30 27
     '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
31 28
     '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
7  django/conf/locale/nb/formats.py
@@ -16,22 +16,17 @@
16 16
 
17 17
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  19
+# Kept ISO formats as they are in first position
19 20
 DATE_INPUT_FORMATS = (
20 21
     '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
21  
-    '%Y-%m-%d',                         # '2006-10-25',
22 22
     # '%d. %b %Y', '%d %b %Y',            # '25. okt 2006', '25 okt 2006'
23 23
     # '%d. %b. %Y', '%d %b. %Y',          # '25. okt. 2006', '25 okt. 2006'
24 24
     # '%d. %B %Y', '%d %B %Y',            # '25. oktober 2006', '25 oktober 2006'
25 25
 )
26  
-TIME_INPUT_FORMATS = (
27  
-    '%H:%M:%S',     # '14:30:59'
28  
-    '%H:%M',     # '14:30'
29  
-)
30 26
 DATETIME_INPUT_FORMATS = (
31 27
     '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
32 28
     '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
33 29
     '%Y-%m-%d',              # '2006-10-25'
34  
-    '%Y-%m-%d',              # '2006-10-25'
35 30
     '%d.%m.%Y %H:%M:%S',     # '25.10.2006 14:30:59'
36 31
     '%d.%m.%Y %H:%M',        # '25.10.2006 14:30'
37 32
     '%d.%m.%Y',              # '25.10.2006'
6  django/conf/locale/nl/formats.py
@@ -16,9 +16,9 @@
16 16
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
18 18
 DATE_INPUT_FORMATS = (
19  
-    '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d', # '20-01-2009', '20-01-09', '2009-01-20'
20  
-    # '%d %b %Y', '%d %b %y',             # '20 jan 2009', '20 jan 09'
21  
-    # '%d %B %Y', '%d %B %y',             # '20 januari 2009', '20 januari 09'
  19
+    '%d-%m-%Y', '%d-%m-%y',             # '20-01-2009', '20-01-09'
  20
+    # '%d %b %Y', '%d %b %y',           # '20 jan 2009', '20 jan 09'
  21
+    # '%d %B %Y', '%d %B %y',           # '20 januari 2009', '20 januari 09'
22 22
 )
23 23
 TIME_INPUT_FORMATS = (
24 24
     '%H:%M:%S',                         # '15:23:35'
6  django/conf/locale/nn/formats.py
@@ -16,17 +16,13 @@
16 16
 
17 17
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  19
+# Kept ISO formats as they are in first position
19 20
 DATE_INPUT_FORMATS = (
20 21
     '%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
21  
-    '%Y-%m-%d',                         # '2006-10-25',
22 22
     # '%d. %b %Y', '%d %b %Y',            # '25. okt 2006', '25 okt 2006'
23 23
     # '%d. %b. %Y', '%d %b. %Y',          # '25. okt. 2006', '25 okt. 2006'
24 24
     # '%d. %B %Y', '%d %B %Y',            # '25. oktober 2006', '25 oktober 2006'
25 25
 )
26  
-TIME_INPUT_FORMATS = (
27  
-    '%H:%M:%S',     # '14:30:59'
28  
-    '%H:%M',     # '14:30'
29  
-)
30 26
 DATETIME_INPUT_FORMATS = (
31 27
     '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
32 28
     '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
9  django/conf/locale/pl/formats.py
@@ -18,20 +18,13 @@
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
19 19
 DATE_INPUT_FORMATS = (
20 20
     '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
21  
-    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
  21
+    '%y-%m-%d',                 # '06-10-25'
22 22
     # '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
23 23
 )
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S', # '14:30:59'
26  
-    '%H:%M',    # '14:30'
27  
-)
28 24
 DATETIME_INPUT_FORMATS = (
29 25
     '%d.%m.%Y %H:%M:%S',    # '25.10.2006 14:30:59'
30 26
     '%d.%m.%Y %H:%M',       # '25.10.2006 14:30'
31 27
     '%d.%m.%Y',             # '25.10.2006'
32  
-    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
33  
-    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
34  
-    '%Y-%m-%d',             # '2006-10-25'
35 28
 )
36 29
 DECIMAL_SEPARATOR = ','
37 30
 THOUSAND_SEPARATOR = ' '
5  django/conf/locale/pt/formats.py
@@ -15,15 +15,12 @@
15 15
 
16 16
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  18
+# Kept ISO formats as they are in first position
18 19
 DATE_INPUT_FORMATS = (
19 20
     '%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
20 21
     # '%d de %b de %Y', '%d de %b, %Y',   # '25 de Out de 2006', '25 Out, 2006'
21 22
     # '%d de %B de %Y', '%d de %B, %Y',   # '25 de Outubro de 2006', '25 de Outubro, 2006'
22 23
 )
23  
-TIME_INPUT_FORMATS = (
24  
-    '%H:%M:%S',     # '14:30:59'
25  
-    '%H:%M',        # '14:30'
26  
-)
27 24
 DATETIME_INPUT_FORMATS = (
28 25
     '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
29 26
     '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
9  django/conf/locale/pt_BR/formats.py
@@ -17,14 +17,10 @@
17 17
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
19 19
 DATE_INPUT_FORMATS = (
20  
-    '%d/%m/%Y', '%d/%m/%y', '%Y-%m-%d', # '25/10/2006', '25/10/06', '2006-10-25'
  20
+    '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
21 21
     # '%d de %b de %Y', '%d de %b, %Y',   # '25 de Out de 2006', '25 Out, 2006'
22 22
     # '%d de %B de %Y', '%d de %B, %Y',   # '25 de Outubro de 2006', '25 de Outubro, 2006'
23 23
 )
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S',     # '14:30:59'
26  
-    '%H:%M',        # '14:30'
27  
-)
28 24
 DATETIME_INPUT_FORMATS = (
29 25
     '%d/%m/%Y %H:%M:%S',     # '25/10/2006 14:30:59'
30 26
     '%d/%m/%Y %H:%M',        # '25/10/2006 14:30'
@@ -32,9 +28,6 @@
32 28
     '%d/%m/%y %H:%M:%S',     # '25/10/06 14:30:59'
33 29
     '%d/%m/%y %H:%M',        # '25/10/06 14:30'
34 30
     '%d/%m/%y',              # '25/10/06'
35  
-    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
36  
-    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
37  
-    '%Y-%m-%d',              # '2006-10-25'
38 31
 )
39 32
 DECIMAL_SEPARATOR = ','
40 33
 THOUSAND_SEPARATOR = '.'
8  django/conf/locale/ru/formats.py
@@ -19,12 +19,7 @@
19 19
 DATE_INPUT_FORMATS = (
20 20
     '%d.%m.%Y',  # '25.10.2006'
21 21
     '%d.%m.%y',  # '25.10.06'
22  
-    '%Y-%m-%d',  # '2006-10-25'
23 22
 )
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S',  # '14:30:59'
26  
-    '%H:%M',     # '14:30'
27  
-) 
28 23
 DATETIME_INPUT_FORMATS = (
29 24
     '%d.%m.%Y %H:%M:%S',  # '25.10.2006 14:30:59'
30 25
     '%d.%m.%Y %H:%M',     # '25.10.2006 14:30'
@@ -32,9 +27,6 @@
32 27
     '%d.%m.%y %H:%M:%S',  # '25.10.06 14:30:59'
33 28
     '%d.%m.%y %H:%M',     # '25.10.06 14:30'
34 29
     '%d.%m.%y',           # '25.10.06'
35  
-    '%Y-%m-%d %H:%M:%S',  # '2006-10-25 14:30:59'
36  
-    '%Y-%m-%d %H:%M',     # '2006-10-25 14:30'
37  
-    '%Y-%m-%d',           # '2006-10-25'
38 30
 )
39 31
 DECIMAL_SEPARATOR = ','
40 32
 THOUSAND_SEPARATOR = '\xa0' # non-breaking space
9  django/conf/locale/sk/formats.py
@@ -18,20 +18,13 @@
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
19 19
 DATE_INPUT_FORMATS = (
20 20
     '%d.%m.%Y', '%d.%m.%y',     # '25.10.2006', '25.10.06'
21  
-    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
  21
+    '%y-%m-%d',                 # '06-10-25'
22 22
     # '%d. %B %Y', '%d. %b. %Y',  # '25. October 2006', '25. Oct. 2006'
23 23
 )
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S', # '14:30:59'
26  
-    '%H:%M',    # '14:30'
27  
-)
28 24
 DATETIME_INPUT_FORMATS = (
29 25
     '%d.%m.%Y %H:%M:%S',    # '25.10.2006 14:30:59'
30 26
     '%d.%m.%Y %H:%M',       # '25.10.2006 14:30'
31 27
     '%d.%m.%Y',             # '25.10.2006'
32  
-    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
33  
-    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
34  
-    '%Y-%m-%d',             # '2006-10-25'
35 28
 )
36 29
 DECIMAL_SEPARATOR = ','
37 30
 THOUSAND_SEPARATOR = '\xa0' # non-breaking space
5  django/conf/locale/sl/formats.py
@@ -21,11 +21,6 @@
21 21
     '%d. %m. %Y', '%d. %m. %y',     # '25. 10. 2006', '25. 10. 06'
22 22
 )
23 23
 
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S',     # '14:30:59'
26  
-    '%H:%M',        # '14:30'
27  
-)
28  
-
29 24
 DATETIME_INPUT_FORMATS = (
30 25
     '%d.%m.%Y %H:%M:%S',            # '25.10.2006 14:30:59'
31 26
     '%d.%m.%Y %H:%M',               # '25.10.2006 14:30'
8  django/conf/locale/sr/formats.py
@@ -18,15 +18,10 @@
18 18
 DATE_INPUT_FORMATS = (
19 19
     '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
20 20
     '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
21  
-    '%Y-%m-%d',                     # '2006-10-25'
22 21
     # '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
23 22
     # '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
24 23
     # '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
25 24
 )
26  
-TIME_INPUT_FORMATS = (
27  
-    '%H:%M:%S',     # '14:30:59'
28  
-    '%H:%M',        # '14:30'
29  
-)
30 25
 DATETIME_INPUT_FORMATS = (
31 26
     '%d.%m.%Y. %H:%M:%S',     # '25.10.2006. 14:30:59'
32 27
     '%d.%m.%Y. %H:%M',        # '25.10.2006. 14:30'
@@ -40,9 +35,6 @@
40 35
     '%d. %m. %y. %H:%M:%S',   # '25. 10. 06. 14:30:59'
41 36
     '%d. %m. %y. %H:%M',      # '25. 10. 06. 14:30'
42 37
     '%d. %m. %y.',            # '25. 10. 06.'
43  
-    '%Y-%m-%d %H:%M:%S',      # '2006-10-25 14:30:59'
44  
-    '%Y-%m-%d %H:%M',         # '2006-10-25 14:30'
45  
-    '%Y-%m-%d',               # '2006-10-25'
46 38
 )
47 39
 DECIMAL_SEPARATOR = ','
48 40
 THOUSAND_SEPARATOR = '.'
8  django/conf/locale/sr_Latn/formats.py
@@ -18,15 +18,10 @@
18 18
 DATE_INPUT_FORMATS = (
19 19
     '%d.%m.%Y.', '%d.%m.%y.',       # '25.10.2006.', '25.10.06.'
20 20
     '%d. %m. %Y.', '%d. %m. %y.',   # '25. 10. 2006.', '25. 10. 06.'
21  
-    '%Y-%m-%d',                     # '2006-10-25'
22 21
     # '%d. %b %y.', '%d. %B %y.',     # '25. Oct 06.', '25. October 06.'
23 22
     # '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
24 23
     # '%d. %b %Y.', '%d. %B %Y.',     # '25. Oct 2006.', '25. October 2006.'
25 24
 )
26  
-TIME_INPUT_FORMATS = (
27  
-    '%H:%M:%S',     # '14:30:59'
28  
-    '%H:%M',        # '14:30'
29  
-)
30 25
 DATETIME_INPUT_FORMATS = (
31 26
     '%d.%m.%Y. %H:%M:%S',     # '25.10.2006. 14:30:59'
32 27
     '%d.%m.%Y. %H:%M',        # '25.10.2006. 14:30'
@@ -40,9 +35,6 @@
40 35
     '%d. %m. %y. %H:%M:%S',   # '25. 10. 06. 14:30:59'
41 36
     '%d. %m. %y. %H:%M',      # '25. 10. 06. 14:30'
42 37
     '%d. %m. %y.',            # '25. 10. 06.'
43  
-    '%Y-%m-%d %H:%M:%S',      # '2006-10-25 14:30:59'
44  
-    '%Y-%m-%d %H:%M',         # '2006-10-25 14:30'
45  
-    '%Y-%m-%d',               # '2006-10-25'
46 38
 )
47 39
 DECIMAL_SEPARATOR = ','
48 40
 THOUSAND_SEPARATOR = '.'
5  django/conf/locale/sv/formats.py
@@ -16,15 +16,12 @@
16 16
 
17 17
 # The *_INPUT_FORMATS strings use the Python strftime format syntax,
18 18
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  19
+# Kept ISO formats as they are in first position
19 20
 DATE_INPUT_FORMATS = (
20 21
     '%Y-%m-%d',              # '2006-10-25'
21 22
     '%m/%d/%Y',              # '10/25/2006'
22 23
     '%m/%d/%y',              # '10/25/06'
23 24
 )
24  
-TIME_INPUT_FORMATS = (
25  
-    '%H:%M:%S',     # '14:30:59'
26  
-    '%H:%M',        # '14:30'
27  
-)
28 25
 DATETIME_INPUT_FORMATS = (
29 26
     '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
30 27
     '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
9  django/conf/locale/tr/formats.py
@@ -17,20 +17,13 @@
17 17
 # see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
18 18
 DATE_INPUT_FORMATS = (
19 19
     '%d/%m/%Y', '%d/%m/%y',     # '25/10/2006', '25/10/06'
20  
-    '%Y-%m-%d', '%y-%m-%d',     # '2006-10-25', '06-10-25'
  20
+    '%y-%m-%d',                 # '06-10-25'
21 21
     # '%d %B %Y', '%d %b. %Y',  # '25 Ekim 2006', '25 Eki. 2006'
22 22
 )
23  
-TIME_INPUT_FORMATS = (
24  
-    '%H:%M:%S', # '14:30:59'
25  
-    '%H:%M',    # '14:30'
26  
-)
27 23
 DATETIME_INPUT_FORMATS = (
28 24
     '%d/%m/%Y %H:%M:%S',    # '25/10/2006 14:30:59'
29 25
     '%d/%m/%Y %H:%M',       # '25/10/2006 14:30'
30 26
     '%d/%m/%Y',             # '25/10/2006'
31  
-    '%Y-%m-%d %H:%M:%S',    # '2006-10-25 14:30:59'
32  
-    '%Y-%m-%d %H:%M',       # '2006-10-25 14:30'
33  
-    '%Y-%m-%d',             # '2006-10-25'
34 27
 )
35 28
 DECIMAL_SEPARATOR = ','
36 29
 THOUSAND_SEPARATOR = '.'
16  django/utils/formats.py
@@ -16,6 +16,17 @@
16 16
 _format_cache = {}
17 17
 _format_modules_cache = {}
18 18
 
  19
+ISO_INPUT_FORMATS = {
  20
+    'DATE_INPUT_FORMATS': ('%Y-%m-%d',),
  21
+    'TIME_INPUT_FORMATS': ('%H:%M:%S', '%H:%M'),
  22
+    'DATETIME_INPUT_FORMATS': (
  23
+        '%Y-%m-%d %H:%M:%S',
  24
+        '%Y-%m-%d %H:%M:%S.%f',
  25
+        '%Y-%m-%d %H:%M',
  26
+        '%Y-%m-%d'
  27
+    ),
  28
+}
  29
+
19 30
 def reset_format_cache():
20 31
     """Clear any cached formats.
21 32
 
@@ -82,6 +93,11 @@ def get_format(format_type, lang=None, use_l10n=None):
82 93
             for module in get_format_modules(lang):
83 94
                 try:
84 95
                     val = getattr(module, format_type)
  96
+                    for iso_input in ISO_INPUT_FORMATS.get(format_type, ()):
  97
+                        if iso_input not in val:
  98
+                            if isinstance(val, tuple):
  99
+                                val = list(val)
  100
+                            val.append(iso_input)
85 101
                     _format_cache[cache_key] = val
86 102
                     return val
87 103
                 except AttributeError:
11  tests/regressiontests/forms/tests/input_formats.py
@@ -14,7 +14,8 @@ def setUp(self):
14 14
         settings.TIME_INPUT_FORMATS = ["%I:%M:%S %p", "%I:%M %p"]
15 15
         settings.USE_L10N = True
16 16
 
17  
-        activate('de')
  17
+        # nl/formats.py has customized TIME_INPUT_FORMATS
  18
+        activate('nl')
18 19
 
19 20
     def tearDown(self):
20 21
         settings.TIME_INPUT_FORMATS = self.old_TIME_INPUT_FORMATS
@@ -100,7 +101,7 @@ def test_localized_timeField_with_inputformat(self):
100 101
         result = f.clean('13.30.05')
101 102
         self.assertEqual(result, time(13,30,5))
102 103
 
103  
-        # # Check that the parsed result does a round trip to the same format
  104
+        # Check that the parsed result does a round trip to the same format
104 105
         text = f.widget._format_value(result)
105 106
         self.assertEqual(text, "13:30:05")
106 107
 
@@ -324,6 +325,9 @@ def test_dateField(self):
324 325
         # Parse a date in an unaccepted format; get an error
325 326
         self.assertRaises(forms.ValidationError, f.clean, '21/12/2010')
326 327
 
  328
+        # ISO formats are accepted, even if not specified in formats.py
  329
+        self.assertEqual(f.clean('2010-12-21'), date(2010,12,21))
  330
+
327 331
         # Parse a date in a valid format, get a parsed result
328 332
         result = f.clean('21.12.2010')
329 333
         self.assertEqual(result, date(2010,12,21))
@@ -619,6 +623,9 @@ def test_dateTimeField(self):
619 623
         # Parse a date in an unaccepted format; get an error
620 624
         self.assertRaises(forms.ValidationError, f.clean, '1:30:05 PM 21/12/2010')
621 625
 
  626
+        # ISO formats are accepted, even if not specified in formats.py
  627
+        self.assertEqual(f.clean('2010-12-21 13:30:05'), datetime(2010,12,21,13,30,5))
  628
+
622 629
         # Parse a date in a valid format, get a parsed result
623 630
         result = f.clean('21.12.2010 13:30:05')
624 631
         self.assertEqual(result, datetime(2010,12,21,13,30,5))
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.