summaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/api.py
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-09-26 13:59:31 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-28 10:45:10 +0100
commite1cca28826dfa66d905dd4daf9964564c355207e (patch)
tree44bd2794a2b1a0ea0dddd652292176eb5e0490a5 /lib/toaster/toastergui/api.py
parentc8db313e907918b0df122006046b157d510ecc1d (diff)
downloadbitbake-contrib-e1cca28826dfa66d905dd4daf9964564c355207e.tar.gz
toaster: project page Implement front end feature to delete project
Add confirm modal and api calls to delete a project from the project dashboard. [YOCTO #6238] Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/toaster/toastergui/api.py')
-rw-r--r--lib/toaster/toastergui/api.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/toaster/toastergui/api.py b/lib/toaster/toastergui/api.py
index 558911802..856918b6a 100644
--- a/lib/toaster/toastergui/api.py
+++ b/lib/toaster/toastergui/api.py
@@ -393,7 +393,7 @@ class XhrCustomRecipeId(View):
""" Get Custom Image recipe or return an error response"""
try:
custom_recipe = \
- CustomImageRecipe.objects.get(pk=recipe_id)
+ CustomImageRecipe.objects.get(pk=recipe_id)
return custom_recipe, None
except CustomImageRecipe.DoesNotExist:
@@ -418,8 +418,12 @@ class XhrCustomRecipeId(View):
if error:
return error
+ project = custom_recipe.project
+
custom_recipe.delete()
- return JsonResponse({"error": "ok"})
+ return JsonResponse({"error": "ok",
+ "gotoUrl": reverse("projectcustomimages",
+ args=(project.pk,))})
class XhrCustomRecipePackages(View):
@@ -820,8 +824,11 @@ class XhrProject(View):
def delete(self, request, *args, **kwargs):
try:
- Project.objects.get(kwargs['project_id']).delete()
+ Project.objects.get(pk=kwargs['project_id']).delete()
except Project.DoesNotExist:
return error_response("Project %s does not exist" %
kwargs['project_id'])
- return JsonResponse({"error": "ok"})
+ return JsonResponse({
+ "error": "ok",
+ "gotoUrl": reverse("all-projects", args=[])
+ })