From 9baa9594c7284273abe40341b9ab89207927fb66 Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Fri, 29 Jul 2016 11:19:43 -0400 Subject: [PATCH] use get_object_or_400 to fetch Role --- awx/api/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/api/views.py b/awx/api/views.py index 23a4c8cc64..32fd3c5b45 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1210,7 +1210,7 @@ class UserRolesList(SubListCreateAttachDetachAPIView): if sub_id == self.request.user.admin_role.pk: raise PermissionDenied('You may not perform any action with your own admin_role.') - role = Role.objects.get(pk=sub_id) + role = get_object_or_400(Role, pk=sub_id) user_content_type = ContentType.objects.get_for_model(User) if role.content_type == user_content_type: raise PermissionDenied('You may not change the membership of a users admin_role')