DateField __year queries don't return all records.
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Severity:||Keywords:||DateField __year query|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When querying a DateField using the __year lookup type, the first day of the year, January 1, is not returned.
I can't speak to why the code is the way it is right now, but my patch changes the __year lookups to be the same as the __month and __day lookups. As quick background, __year lookups are handled using 'between' in the where clause, versus an SQL function for __month and __day.
- test.diff modifies the basic test case to highlight the error.
- fix.diff fixes the bug.
All tests appear to run correctly against sqlite and postgresql.