From: Guillaume Pellerin Date: Thu, 17 Jun 2021 16:03:42 +0000 (+0200) Subject: update account export command X-Git-Tag: 1.4.3~2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f9f165388c8d7023c41bb67ca7ce9999824c2922;p=teleforma.git update account export command --- diff --git a/teleforma/management/commands/teleforma-export-wifi-accounts.py b/teleforma/management/commands/teleforma-export-wifi-accounts.py index 7b969122..6847dfbb 100644 --- a/teleforma/management/commands/teleforma-export-wifi-accounts.py +++ b/teleforma/management/commands/teleforma-export-wifi-accounts.py @@ -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'))