From 44c092d8f379af24ac8e1dbfc571bc41d12ed4c6 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 28 Jul 2014 15:59:05 +0200 Subject: [PATCH] add export file for wifi pass init --- teleforma/management/commands/teleforma-init-wifi-pass.py | 7 +++++++ 1 file changed, 7 insertions(+) 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() -- 2.39.5