]> git.parisson.com Git - teleforma.git/commitdiff
add export file for wifi pass init
authorGuillaume Pellerin <yomguy@parisson.com>
Mon, 28 Jul 2014 13:59:05 +0000 (15:59 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Mon, 28 Jul 2014 13:59:05 +0000 (15:59 +0200)
teleforma/management/commands/teleforma-init-wifi-pass.py

index 25f5e5f3f9e653c3e36d036304f89adf04f87c14..569656025e00af8fbec30b5cee03c14dbedca70d 100644 (file)
@@ -17,11 +17,18 @@ def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
 
 class Command(BaseCommand):
     help = "init all user wifi pass"
+       args = 'path'
 
     def handle(self, *args, **options):
+       path = args[0]
+        f = open(path, 'w')
+
         for user in User.objects.all():
             profile = user.profile.get()
             if not profile.wifi_pass:
                 profile.wifi_login = user.username + '.' + args[-1]
                 profile.wifi_pass = id_generator(8)
                 profile.save()
+                f.write(profile.wifi_login + ',' + profile.wifi_pass + '\n')
+
+               f.close()