diff --git a/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py b/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py index 4c74434921979b88733a19428f9ba693b6b8d214..7bc2828f4835be9ebd4c98e727c1b37779340811 100644 --- a/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py +++ b/ssoauth/management/commands/ssoauth_setup_groups_and_perms.py @@ -16,13 +16,14 @@ def get_or_create_permission(codename, create_with_name=None): :return: permission object Ensures the permissions exists. Creates it if needed. """ + user_content_type = get_user_content_type() try: - perm = Permission.objects.get(codename=codename) + perm = Permission.objects.get(codename=codename, content_type=user_content_type) except Permission.DoesNotExist: perm = Permission.objects.create( codename=codename, name=create_with_name or codename, - content_type=get_user_content_type() + content_type=user_content_type ) logger.info("Created permission: {0}".format(perm)) return perm