]> git.parisson.com Git - teleforma.git/commitdiff
Filter by period
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 13 Jul 2018 10:58:33 +0000 (12:58 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 13 Jul 2018 10:58:33 +0000 (12:58 +0200)
teleforma/management/commands/teleforma-export-wifi-accounts.py

index 78cf43f01d9fe19c78afbf5edf2d7893c5c18860..fc839ddf4f9c01ca1b69a501a9aeb35ee20bc2bd 100644 (file)
@@ -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()
+