aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/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-30 16:52:22 +0100
commit0d70606022cad010f586ec29b558ee902be765ef (patch)
treedfcfb5b5ca63c6c1047807fd64ec482d73a2b1a5 /bitbake/lib/toaster/toastergui/api.py
parent7ca44f53bccf48d289c5f53c00ca7026aacef6dd (diff)
downloadopenembedded-core-contrib-0d70606022cad010f586ec29b558ee902be765ef.tar.gz
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 <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 'bitbake/lib/toaster/toastergui/api.py')
-rw-r--r--bitbake/lib/toaster/toastergui/api.py15
1 files changed, 11 insertions, 4 deletions
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=[])
+ })