From 706983d73996637148d640281b5a5e97f217b9b5 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sun, 5 Feb 2017 16:12:51 +0100 Subject: Mise en commun de la fonction de récupération des semaines --- management/commands/sendmails.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'management/commands/sendmails.py') diff --git a/management/commands/sendmails.py b/management/commands/sendmails.py index a134d80..b700990 100644 --- a/management/commands/sendmails.py +++ b/management/commands/sendmails.py @@ -5,7 +5,7 @@ from django.template import Context, loader from django.conf import settings from edt.models import Group, Subscription, Course -from edt.utils import get_week, group_courses +from edt.utils import get_current_or_next_week, get_week, group_courses import datetime @@ -16,10 +16,7 @@ class Command(BaseCommand): def handle(self, *args, **options): translation.activate(settings.LANGUAGE_CODE) - year, week, day = timezone.now().isocalendar() - if day >= 6: - year, week, _ = (timezone.now() + datetime.timedelta(weeks=1)).isocalendar() - + year, week = get_current_or_next_week() start, end = get_week(year, week) subscriptions = Subscription.objects.filter(active=True) -- cgit v1.2.1