From 11f2c7f3e54cb30bbd8817f50fe9de216f02276a Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 16 Jul 2014 01:09:49 +0200 Subject: [PATCH] add wifi commands --- teleforma/exam/templates/exam/scripts.html | 13 +++++----- .../teleforma-export-wifi-accounts.py | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 teleforma/management/commands/teleforma-export-wifi-accounts.py diff --git a/teleforma/exam/templates/exam/scripts.html b/teleforma/exam/templates/exam/scripts.html index 8e6636bc..b80105cf 100644 --- a/teleforma/exam/templates/exam/scripts.html +++ b/teleforma/exam/templates/exam/scripts.html @@ -51,13 +51,12 @@
{{ title }}
{% if messages %} -
- {% for message in messages %} - {{ message }}
- {% endfor %} - - {% endif %} - +
+ {% for message in messages %} + {{ message }}
+ {% endfor %} + +{% endif %}
{% if object_list %} diff --git a/teleforma/management/commands/teleforma-export-wifi-accounts.py b/teleforma/management/commands/teleforma-export-wifi-accounts.py new file mode 100644 index 00000000..6d1ce16f --- /dev/null +++ b/teleforma/management/commands/teleforma-export-wifi-accounts.py @@ -0,0 +1,25 @@ +from optparse import make_option +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 + + +class Command(BaseCommand): + help = "Export all WiFi accounts" + args = 'path' + + def handle(self, *args, **options): + path = args[0] + f = open(path, 'w') + + for user in User.objects.all(): + profile = user.profile.get() + f.write(profile.wifi_login + ',' + profile.wifi_pass + '\n') + + f.close() -- 2.39.5