Opened 15 years ago
Closed 10 years ago
#12489 closed New feature (fixed)
Need a Field Lookup for day of year: __dayofyear
Reported by: | Dean Quinanola | Owned by: | v1v3kn |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | Normal | Keywords: | field lookup datetime filter |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The current built-in year, month, day, week_day Field Lookups do not directly help if you need to find rows that are on a specific date. In SQL, there is a DAYOFYEAR(). It would be useful to have a Field Lookup that pairs this function with python datetime's %j directive
Attachments (2)
Change History (14)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Version: | 1.1 |
comment:2 by , 14 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 14 years ago
Has patch: | set |
---|
comment:4 by , 14 years ago
Needs documentation: | set |
---|
comment:5 by , 14 years ago
Needs documentation: | unset |
---|
comment:6 by , 14 years ago
milestone: | → 1.3 |
---|
comment:7 by , 14 years ago
milestone: | 1.3 → 1.4 |
---|
This is a feature addition, and the deadline for new features in 1.3 passed some time ago.
by , 14 years ago
Attachment: | django12489.diff added |
---|
Implemented day_of_year & week_of_year with tests
comment:8 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:9 by , 14 years ago
Easy pickings: | unset |
---|---|
Needs documentation: | set |
comment:12 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The custom lookups introduced in Django 1.7 can be used to implement this feature.
See https://docs.djangoproject.com/en/1.7/ref/models/custom-lookups/
DAY_OF_YEAR is starting to get a bit esoteric, but I can't see any harm providing it, along with it's analogs WEEK and WEEK_OF_YEAR.
Related: #8424 describes adding HOUR/MINUTE/SECOND filters.