Don't try to migrate accounts if the SimpleUsers group does not exist (fresh install).

see #204
This commit is contained in:
Antoine Nguyen
2012-04-26 17:29:44 +02:00
parent 3924c2bd3d
commit 4f0cd1215b
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -8,7 +8,10 @@ class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
sugroup = orm["auth.Group"].objects.get(name="SimpleUsers")
try:
sugroup = orm["auth.Group"].objects.get(name="SimpleUsers")
except orm["auth.Group"].DoesNotExist:
return
for account in orm["auth.User"].objects.all():
if not len(account.groups.all()):
account.groups.add(sugroup)