From bf67d47ecbdf123568bfc4a1c5de960e9a266301 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Fri, 13 Jul 2018 13:01:55 +0200 Subject: [PATCH] fix period --- .../management/commands/teleforma-export-wifi-accounts.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/teleforma/management/commands/teleforma-export-wifi-accounts.py b/teleforma/management/commands/teleforma-export-wifi-accounts.py index fc839ddf..f8a40f32 100644 --- a/teleforma/management/commands/teleforma-export-wifi-accounts.py +++ b/teleforma/management/commands/teleforma-export-wifi-accounts.py @@ -19,14 +19,15 @@ class Command(BaseCommand): period_name = args[1] f = open(path, 'w') - + period = Period.objects.get(name=period_name) + for user in User.objects.all(): profile = Profile.objects.filter(user=user) students = user.student.all() if profile and students: p = profile[0] student = students[0] - if student.is_subscribed and not user.is_active and student.period == period: + if student.is_subscribed and user.is_active and student.period == period: f.write(p.wifi_login + ',' + p.wifi_pass + '\n') f.close() -- 2.39.5