From abc9722b301d1c6d3a40559d4538ac4e55328011 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 15 Jul 2015 12:44:09 +0200 Subject: [PATCH] fix no profile --- .../commands/teleforma-init-wifi-pass.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/teleforma/management/commands/teleforma-init-wifi-pass.py b/teleforma/management/commands/teleforma-init-wifi-pass.py index 254a0b7a..1b5442de 100644 --- a/teleforma/management/commands/teleforma-init-wifi-pass.py +++ b/teleforma/management/commands/teleforma-init-wifi-pass.py @@ -24,11 +24,14 @@ class Command(BaseCommand): f = open(path, 'w') for user in User.objects.all(): - profile = user.profile.get() - if not profile.wifi_pass: - profile.wifi_login = user.username - profile.wifi_pass = id_generator(8) - profile.save() - f.write(profile.wifi_login + ',' + profile.wifi_pass + '\n') + try: + profile = user.profile.get() + if not profile.wifi_pass: + profile.wifi_login = user.username + profile.wifi_pass = id_generator(8) + profile.save() + f.write(profile.wifi_login + ',' + profile.wifi_pass + '\n') + except: + continue f.close() -- 2.39.5