newforms: DateField doesn't handle date output formats
|Reported by:||orestis@…||Owned by:||ajs|
|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:1 Changed 7 years ago by Simon G. <dev@…>
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Design decision needed
comment:8 Changed 7 years ago by gwilson
- Has patch set
- Needs tests set
- Patch needs improvement set
- Triage Stage changed from Design decision needed to Accepted