don't display Monday collect day on Friday eve (#10859)

This commit is contained in:
Serghei Mihai 2016-05-09 10:28:03 +02:00
parent 612e451386
commit e1a697c433
1 changed files with 5 additions and 1 deletions

View File

@ -152,7 +152,11 @@ class AvailableDaysView(View, SingleObjectMixin):
def get(self, request, *args, **kwargs):
sector = get_sector(kwargs.get('insee'), request.GET.get('adresse'))
if sector:
collect_days = sector.collectday_set.filter(date__gt=datetime.datetime.today()+datetime.timedelta(days=1)).order_by('date')
if datetime.datetime.today().weekday() == 4:
tomorrow = datetime.datetime.today() + datetime.timedelta(days=3)
else:
tomorrow = datetime.datetime.today() + datetime.timedelta(days=1)
collect_days = sector.collectday_set.filter(date__gt=tomorrow).order_by('date')
else:
collect_days = []
limit = request.GET.get('limit')