From 3f1e8beedfc522c5c385bfc68f01a2514f9ddb2b Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 4 Feb 2016 17:06:56 +0100 Subject: [PATCH] add period for account activation --- teleforma/management/commands/teleforma-students-activate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teleforma/management/commands/teleforma-students-activate.py b/teleforma/management/commands/teleforma-students-activate.py index 0dbe9e7e..9fe55709 100644 --- a/teleforma/management/commands/teleforma-students-activate.py +++ b/teleforma/management/commands/teleforma-students-activate.py @@ -31,16 +31,18 @@ class Command(BaseCommand): help = "Activate all user account for subscribed students" def handle(self, *args, **options): + period_name = args[-2] log_file = args[-1] logger = Logger(log_file) logger.logger.info('########### Processing #############') users = User.objects.all() + period = Period.objects.get(name=period_name) for user in users: students = user.student.all() if students: student = students[0] - if student.is_subscribed and not user.is_active: + if student.is_subscribed and not user.is_active and student.period == period: user.is_active = True user.save() logger.logger.info('init : ' + user.username) -- 2.39.5