]> git.parisson.com Git - teleforma.git/commitdiff
fix profile
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 16 Jul 2014 14:24:03 +0000 (16:24 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 16 Jul 2014 14:24:03 +0000 (16:24 +0200)
teleforma/management/commands/teleforma-export-wifi-accounts.py

index 6d1ce16f5a4cbfabb73edf989dcb6f5cca2a5216..70d503b0a4bb92783ab5589652d010d710f6313a 100644 (file)
@@ -15,11 +15,12 @@ class Command(BaseCommand):
     args = 'path'
 
     def handle(self, *args, **options):
-       path = args[0]
-       f = open(path, 'w')
+        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')
+        for user in User.objects.all():
+            profile = user.profile.get()
+            if profile:
+               f.write(profile.wifi_login + ',' + profile.wifi_pass + '\n')
 
-       f.close()
+        f.close()