From: Guillaume Pellerin Date: Tue, 15 Jul 2014 23:09:49 +0000 (+0200) Subject: add wifi commands X-Git-Tag: 1.1~426 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=11f2c7f3e54cb30bbd8817f50fe9de216f02276a;p=teleforma.git add wifi commands --- 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()