aboutsummaryrefslogtreecommitdiff
path: root/management/commands/sendmails.py
diff options
context:
space:
mode:
authorAlban Gruin2017-02-05 16:12:51 +0100
committerAlban Gruin2017-02-05 16:12:51 +0100
commit706983d73996637148d640281b5a5e97f217b9b5 (patch)
tree287ee3507aba1e30cfb96edb2b309c7bfee31681 /management/commands/sendmails.py
parent04162486502fee0fc6aa26aecd6919bde4cd3f73 (diff)
Mise en commun de la fonction de récupération des semaines
Diffstat (limited to 'management/commands/sendmails.py')
-rw-r--r--management/commands/sendmails.py7
1 files changed, 2 insertions, 5 deletions
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)