SelectDateField doesn't retain partially posted values when USE_L10N=True
|Reported by:||russellm||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you have localization enabled, and you have a SelectDateField (django.forms.extras.widgets), and you post a year, month and day value, the widget works as advertised.;
However, if you only post partial data (e.g., only the year and month, but *not* the day), the year and month value are not preserved; the widgets are reset to empty values.
This is inconsistent with the unlocalized behavior, which will preserve all available data.
This is because strftime can't format missing values, and strptime can't parse missing values. The parsing failure is turned into a None value for the entire date, rather than retaining partial data in a '2010-04-00' type structure as happens with unlocalized inputs.
Change History (3)
comment:1 Changed 6 years ago by russellm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted