Make `input_formats` and `format` work consistently across `date`, `datetime`, and `time` fields and widgets.
|Reported by:||mrmachine||Owned by:||kmtracey|
|Severity:||Normal||Keywords:||datetime format widget i18n-rf|
|Cc:||real.human@…, david||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently, there are some inconsistencies in what form fields and widgets we have available for date, datetime, and time data. There are also inconsistencies in how the format argument applies to the widgets, and the input_formats applies to the fields.
- DateTimeInput and TimeInput exist, DateInput doesn't.
- DateTimeInput accepts format, but TimeInput doesn't.
- SplitDateTimeField doesn't use SplitDateTimeWidget by default.
- SplitDateTimeField doesn't allow the user to specify input_formats.
- SplitDateTimeWidget uses two TextInput widgets, instead of TimeInput and the missing DateInput (and thus doesn't allow the user to specify formats).
- django.contrib.localflavor.generic.forms is missing SplitDateTimeField.
- The documentation is sparse on detail for SplitDateTimeField, DateTimeInput and TimeInput.
- Adds DateInput, which accepts format, and is used for DateField by default.
- Adds format as an argument to TimeInput.
- Uses SplitDateTimeWidget for SplitDateTimeField by default.
- Adds input_date_formats and input_time_formats as arguments to SplitDateTimeField.
- Uses DateInput and TimeInput for SplitDateTimeWidget, and passes through date_format and time_format through to DateInput and TimeInput as format, respectively.
- Adds SplitDateTimeField to django.contrib.localflavor.generic.forms.
- Adds documentation for all of these changes.
- Adds tests for all of these changes.
Change History (17)
comment:1 Changed 6 years ago by mrmachine
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:9 Changed 6 years ago by jacob
- milestone set to 1.1 beta
- Triage Stage changed from Unreviewed to Accepted
comment:11 Changed 6 years ago by kmtracey
- Resolution set to fixed
- Status changed from new to closed