Opened 8 years ago
Closed 7 years ago
#28650 closed New feature (fixed)
Add TruncWeek
Description ¶
Add TruncWeek
class to truncate date/datetime fields to midnight at the monday of the week. This is useful to e.g. group values by week.
from django.db.models.functions import TruncWeek SomeModel.objects.annotate( monday_of_week=TruncWeek('some_date'), ).values( 'monday_of_week', ).annotate( sum=Sum('some_field'), )
Change History (3)
comment:1 by , 8 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 8 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
PR