From 6685c82e28903d0fc22d51d0ca90df827eb829da Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 17 Jun 2021 18:03:42 +0200 Subject: [PATCH] update account export command --- .../commands/teleforma-export-wifi-accounts.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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')) -- 2.39.5