From 0d70606022cad010f586ec29b558ee902be765ef Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Mon, 26 Sep 2016 13:59:31 +0300 Subject: bitbake: 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] (Bitbake rev: e1cca28826dfa66d905dd4daf9964564c355207e) Signed-off-by: Michael Wood Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/api.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/api.py') diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index 5589118027..856918b6a3 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/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=[]) + }) -- cgit v1.2.3-54-g00ecf