]> git.parisson.com Git - teleforma.git/commitdiff
update account export command
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 17 Jun 2021 16:03:42 +0000 (18:03 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Thu, 17 Jun 2021 16:03:58 +0000 (18:03 +0200)
teleforma/management/commands/teleforma-export-wifi-accounts.py

index 7b96912285b0b3db9ac5527e79ac6dfd336d2f8f..6847dfbbcf892de2210ab40b39cd679d7d0a1dbe 100644 (file)
@@ -3,8 +3,6 @@ from django.conf import settings
 from django.core.management.base import BaseCommand, CommandError
 from django.contrib.auth.models import User
 from django.template.defaultfilters import slugify
-from telemeta.models import *
-from telemeta.util.unaccent import unaccent
 from teleforma.exam.models import *
 import logging
 import codecs
@@ -20,17 +18,21 @@ class Command(BaseCommand):
 
         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]
+                p = profile[0]
                 student = students[0]
                 if student.is_subscribed and user.is_active and student.period == period:
                     data = []
-                    data.append(p.wifi_login)
-                    data.append(p.wifi_pass)
+                    data.append(u.first_name)
+                    data.append(u.last_name)
+                    data.append(period.date_begin)
+                    data.append(period.date_end)
+                    # data.append(p.wifi_login)
+                    # data.append(p.wifi_pass)
                     data.append('\n')
                     s = ','.join(data)
                     f.write(s.encode('utf8'))