#28649: Add "week_year" lookup to DateField/DateTimeField
-------------------------------------+-------------------------------------
Reporter: Sigurd Ljødal | Owner: Sigurd
| Ljødal
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: ORM Extract | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Sigurd Ljødal):
Sure, I'm 100% open to changing the name. I wasn't sure how Django
normally did this, as e.g. `ExtractWeek` do not refer to ISO in its name,
even though it follows the ISO-standard. It also appears that I have some
bugs to fix, so I'll have to look into that too.
Just to clarify for anyone else, what I'm intending here is to allow
grouping by year and week, which is currently not possible in a good and
supported way. The issue is with the difference in year as shown below. If
I where to group values using `ExtractYear` and `ExtractWeek`, any values
from Jan. 1st 2017 would show up as week 52 of 2017, which is completely
wrong.
{{{
In [1]: from datetime import date
In [2]: d = date(2017,1,1)
In [3]: d.isocalendar()
Out[3]: (2016, 52, 7)
In [4]: d.year
Out[4]: 2017
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28649#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.7586f402eee01427c40343d49e05bc05%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.