From: Guillaume Pellerin Date: Mon, 28 Jul 2014 13:59:05 +0000 (+0200) Subject: add export file for wifi pass init X-Git-Tag: 1.1~337 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=44c092d8f379af24ac8e1dbfc571bc41d12ed4c6;p=teleforma.git add export file for wifi pass init --- diff --git a/teleforma/management/commands/teleforma-init-wifi-pass.py b/teleforma/management/commands/teleforma-init-wifi-pass.py index 25f5e5f3..56965602 100644 --- a/teleforma/management/commands/teleforma-init-wifi-pass.py +++ b/teleforma/management/commands/teleforma-init-wifi-pass.py @@ -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()