Opened 15 years ago
Closed 15 years ago
#11367 closed (duplicate)
Use settings instead of defaults for forms.DateField and similars
Reported by: | Henrique C. Alves | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | forms newforms settings date time | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There's already two settings used by the template date
and time
filters (DATE_FORMAT
and TIME_FORMAT
), used for formatting in similar way as PHP's date()
. Form fields like Date and Time, OTH, use strftime()
formatting strings, and have hardcoded defaults.
It's common to inherit from those fields just for changing default formats and avoid boilerplate code (e.g, having to set date_format=
in every form).
Those fields could, instead, make use of the DATE_FORMAT and TIME_FORMAT settings as defaults, if those are present.
#5526 is an even better approach to solve this on a locale-aware way. Might consider discussing this for 1.2?