From: Guillaume Pellerin Date: Fri, 13 Jul 2018 10:58:33 +0000 (+0200) Subject: Filter by period X-Git-Tag: 1.3.1~15^2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=56a3000a9f8e80c05eaca1154ce129dc70b67ece;p=teleforma.git Filter by period --- diff --git a/teleforma/management/commands/teleforma-export-wifi-accounts.py b/teleforma/management/commands/teleforma-export-wifi-accounts.py index 78cf43f0..fc839ddf 100644 --- a/teleforma/management/commands/teleforma-export-wifi-accounts.py +++ b/teleforma/management/commands/teleforma-export-wifi-accounts.py @@ -16,12 +16,18 @@ class Command(BaseCommand): def handle(self, *args, **options): path = args[0] + period_name = args[1] + f = open(path, 'w') for user in User.objects.all(): profile = Profile.objects.filter(user=user) - if profile: + students = user.student.all() + if profile and students: p = profile[0] - f.write(p.wifi_login + ',' + p.wifi_pass + '\n') + student = students[0] + if student.is_subscribed and not user.is_active and student.period == period: + f.write(p.wifi_login + ',' + p.wifi_pass + '\n') f.close() +