remove URL and add roles endpoint for JobTemplate

This commit is contained in:
Wayne Witzel III
2016-05-10 16:29:11 -04:00
parent 358bc31450
commit 6a5f4d6113
3 changed files with 17 additions and 3 deletions

View File

@@ -2480,6 +2480,18 @@ class JobTemplateAccessList(ResourceAccessList):
resource_model = JobTemplate
new_in_300 = True
class JobTemplateRolesList(SubListAPIView):
model = Role
serializer_class = RoleSerializer
parent_model = JobTemplate
new_in_300 = True
def get_queryset(self):
jt = self.get_parent_object()
content_type = ContentType.objects.get_for_model(JobTemplate)
return Role.objects.filter(content_type=content_type, object_id=jt.pk).all()
class SystemJobTemplateList(ListAPIView):
model = SystemJobTemplate