Opened 14 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)

django12489.docs.diff (1.3 KB ) - added by v1v3kn 13 years ago.
Documentation for the patch
django12489.diff (7.2 KB ) - added by v1v3kn 13 years ago.
Implemented day_of_year & week_of_year with tests

Download all attachments as: .zip

Change History (14)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted
Version: 1.1

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.

comment:2 by v1v3kn, 13 years ago

Owner: changed from nobody to v1v3kn
Status: newassigned

comment:3 by v1v3kn, 13 years ago

Has patch: set

comment:4 by Łukasz Rekucki, 13 years ago

Needs documentation: set

by v1v3kn, 13 years ago

Attachment: django12489.docs.diff added

Documentation for the patch

comment:5 by v1v3kn, 13 years ago

Needs documentation: unset

comment:6 by v1v3kn, 13 years ago

milestone: 1.3

comment:7 by Russell Keith-Magee, 13 years ago

milestone: 1.31.4

This is a feature addition, and the deadline for new features in 1.3 passed some time ago.

by v1v3kn, 13 years ago

Attachment: django12489.diff added

Implemented day_of_year & week_of_year with tests

comment:8 by Matt McClanahan, 13 years ago

Severity: Normal
Type: New feature

comment:9 by Jannis Leidel, 13 years ago

Easy pickings: unset
Needs documentation: set

comment:10 by Ulrich Petri, 13 years ago

UI/UX: unset

Related: #16187 Refactor of the lookup system

comment:11 by Jacob, 12 years ago

milestone: 1.4

Milestone 1.4 deleted

comment:12 by Aymeric Augustin, 10 years ago

Resolution: fixed
Status: assignedclosed

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/

Note: See TracTickets for help on using tickets.
Back to Top