newforms: DateField doesn't handle date output formats
|Reported by:||Owned by:||Adi J. Sieker|
|Severity:||Normal||Keywords:||DateField l10n localization format input output|
|Cc:||scott@…, gary.wilson@…, jesse.lovelace@…, ajs@…, blake@…, andy@…, tao_jonesin@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
As it stands, the when using a newforms.DateField with specified input
formats, it gets parsed alright, but when rendering the form there is
no way to specify the output format, it gets printed as YYYY-MM-DD.
By looking in the source code, I haven't been able to find anything related to this, so I think DateField needs some tweaking.
This not only is a bad localization practice, it makes _using_ the
input formats impossible, since when re-submitting a populated form
without changes, you get validation errors.
Since we can define multiple input formats, but there is only one output format (obviously), I suggest:
a) Defining a new parameter, output_format
b) Make it optional, and set it to the first input format defined in the form field.
Change History (29)
comment:8 Changed 10 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Design decision needed → Accepted|