adjusts users and groups startup scripts to accomdate non-uniqueness

This commit is contained in:
Les Begnaud 2019-07-26 14:13:15 -05:00
parent 5a4e9d7a14
commit e6e7647f32
2 changed files with 4 additions and 4 deletions

View File

@ -29,6 +29,6 @@ with file.open('r') as stream:
if user_permissions:
user.user_permissions.clear()
for permission_codename in user_details.get('permissions', []):
permission = Permission.objects.get(codename=permission_codename)
user.user_permissions.add(permission)
for permission in Permission.objects.filter(codename=permission_codename):
user.user_permissions.add(permission)
user.save()

View File

@ -29,5 +29,5 @@ with file.open('r') as stream:
group.permissions.clear()
print("Permissions:", group.permissions.all())
for permission_codename in group_details.get('permissions', []):
permission = Permission.objects.get(codename=permission_codename)
group.permissions.add(permission)
for permission in Permission.objects.filter(codename=permission_codename):
group.permissions.add(permission)