From: Guillaume Pellerin Date: Thu, 4 Feb 2016 16:06:56 +0000 (+0100) Subject: add period for account activation X-Git-Tag: 1.1~77 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=3f1e8beedfc522c5c385bfc68f01a2514f9ddb2b;p=teleforma.git add period for account activation --- 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)