mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-19 05:58:34 +02:00
Don't try to migrate accounts if the SimpleUsers group does not exist (fresh install).
see #204
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user