Remove some date ranges

This commit is contained in:
Paweł Jastrzębski 2021-04-22 19:58:13 +02:00
parent 6f835a4f27
commit e9536f1816

View File

@ -25,17 +25,11 @@ class DateRangeMixin:
def get_date_ranges(self): def get_date_ranges(self):
now = timezone.now() now = timezone.now()
return [ return [
{'name': 'Today', 'start': now, 'end': now},
{ {
'name': 'Yesterday', 'name': 'Yesterday',
'start': now - timezone.timedelta(days=1), 'start': now - timezone.timedelta(days=1),
'end': now - timezone.timedelta(days=1), 'end': now - timezone.timedelta(days=1),
}, },
{
'name': 'Last 7 days',
'start': now - timezone.timedelta(days=7),
'end': now,
},
{ {
'name': 'Last 30 days', 'name': 'Last 30 days',
'start': now - timezone.timedelta(days=30), 'start': now - timezone.timedelta(days=30),
@ -61,11 +55,6 @@ class DateRangeMixin:
'start': now.replace(day=1, month=1), 'start': now.replace(day=1, month=1),
'end': now, 'end': now,
}, },
{
'name': 'Last year',
'start': now.replace(day=1, month=1, year=now.year - 1),
'end': now.replace(day=1, month=1) - timezone.timedelta(days=1),
},
] ]
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):