'week_day' lookup type should use python's values for lookup
|Reported by:||Semmel||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
#7672 introduced a new lookup type for weekdays that was committed in . The problem are that values that it uses. There already was some discussion about the values but they eventually settled on Sunday=1 and Saturday=6. Imho this is not the best decision. Of course it is obvious that they ended up with these values because that's what the databases are using mostly but there are problems when used with e.g. Python internals.
Python always starts with Monday being the first day of the week whether you use weekday() (Monday=0) or isoweekday() (Monday=1). The Python behaviour also conforms to national/international standards and recommendations like ISO 8601 or DIN 1355 where it also starts with Monday being the first day of the week.
I looked at the code and i know that it requires some conversion and changes for this but it would be even worse if you had to do that conversion every time you're using that django feature. So my suggestions is to change the behaviour to that of Python's weekday().
Change History (4)
comment:1 Changed 7 years ago by kmtracey
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to wontfix
- Status changed from new to closed
comment:3 Changed 7 years ago by Semmel
- Resolution wontfix deleted
- Status changed from closed to reopened