Use settings instead of defaults for forms.DateField and similars
|Reported by:||Henrique C. Alves||Owned by:||nobody|
|Severity:||Keywords:||forms newforms settings date time|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
There's already two settings used by the template
time filters (
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.