summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Jones <matburt@redhat.com>2016-07-14 18:40:37 +0200
committerMatthew Jones <matburt@redhat.com>2016-07-14 18:40:37 +0200
commitc8525031632d03e965888e24308b7378dd96282d (patch)
tree7ddb208554a51296857813cebfbfb93ab0d2825c
parentAdd delete protection from certain objects (diff)
downloadawx-c8525031632d03e965888e24308b7378dd96282d.tar.xz
awx-c8525031632d03e965888e24308b7378dd96282d.zip
Fix up some flake8 issues
-rw-r--r--awx/api/views.py3
-rw-r--r--awx/main/access.py2
2 files changed, 1 insertions, 4 deletions
diff --git a/awx/api/views.py b/awx/api/views.py
index 4af8a6561e..64ea980f66 100644
--- a/awx/api/views.py
+++ b/awx/api/views.py
@@ -2189,9 +2189,6 @@ class JobTemplateDetail(RetrieveUpdateDestroyAPIView):
can_delete = request.user.can_access(JobTemplate, 'delete', obj)
if not can_delete:
raise PermissionDenied("Cannot delete job template.")
- if obj.jobs.filter(status__in=['new', 'pending', 'waiting', 'running']).exists():
- return Response({"error": "Delete not allowed while there are jobs running"},
- status=status.HTTP_405_METHOD_NOT_ALLOWED)
return super(JobTemplateDetail, self).destroy(request, *args, **kwargs)
diff --git a/awx/main/access.py b/awx/main/access.py
index 3b75a6cd98..af05c58be6 100644
--- a/awx/main/access.py
+++ b/awx/main/access.py
@@ -761,7 +761,7 @@ class ProjectAccess(BaseAccess):
return self.user in obj.admin_role
def can_delete(self, obj):
- is_change_allowed = self.can_change(obj, None)
+ is_change_allowed = self.can_change(obj, None)
if not is_change_allowed:
return False
active_jobs = []