]> git.parisson.com Git - teleforma.git/commitdiff
add wifi commands
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 15 Jul 2014 23:09:49 +0000 (01:09 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 15 Jul 2014 23:09:49 +0000 (01:09 +0200)
teleforma/exam/templates/exam/scripts.html
teleforma/management/commands/teleforma-export-wifi-accounts.py [new file with mode: 0644]

index 8e6636bc90da21dfdffe37bfeb20b3823ebc7991..b80105cff2a90033ef360330ce5423a0040ba75e 100644 (file)
 <div class="course_title">{{ title }}</div>
 
 {% if messages %}
-         <div class="messages">
-            {% for message in messages %}
-            <div{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</div>
-            {% endfor %}
-         </div>
-    {% endif %}
-
+    <div class="messages">
+        {% for message in messages %}
+          <div{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</div>
+        {% endfor %}
+    </div>
+{% endif %}
 <br />
 
  {% 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 (file)
index 0000000..6d1ce16
--- /dev/null
@@ -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()