diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-09-26 13:59:31 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-30 16:52:22 +0100 |
commit | 0d70606022cad010f586ec29b558ee902be765ef (patch) | |
tree | dfcfb5b5ca63c6c1047807fd64ec482d73a2b1a5 /bitbake/lib/toaster/toastergui/api.py | |
parent | 7ca44f53bccf48d289c5f53c00ca7026aacef6dd (diff) | |
download | poky-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.py | 15 |
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): | |||
393 | """ Get Custom Image recipe or return an error response""" | 393 | """ Get Custom Image recipe or return an error response""" |
394 | try: | 394 | try: |
395 | custom_recipe = \ | 395 | custom_recipe = \ |
396 | CustomImageRecipe.objects.get(pk=recipe_id) | 396 | CustomImageRecipe.objects.get(pk=recipe_id) |
397 | return custom_recipe, None | 397 | return custom_recipe, None |
398 | 398 | ||
399 | except CustomImageRecipe.DoesNotExist: | 399 | except CustomImageRecipe.DoesNotExist: |
@@ -418,8 +418,12 @@ class XhrCustomRecipeId(View): | |||
418 | if error: | 418 | if error: |
419 | return error | 419 | return error |
420 | 420 | ||
421 | project = custom_recipe.project | ||
422 | |||
421 | custom_recipe.delete() | 423 | custom_recipe.delete() |
422 | return JsonResponse({"error": "ok"}) | 424 | return JsonResponse({"error": "ok", |
425 | "gotoUrl": reverse("projectcustomimages", | ||
426 | args=(project.pk,))}) | ||
423 | 427 | ||
424 | 428 | ||
425 | class XhrCustomRecipePackages(View): | 429 | class XhrCustomRecipePackages(View): |
@@ -820,8 +824,11 @@ class XhrProject(View): | |||
820 | 824 | ||
821 | def delete(self, request, *args, **kwargs): | 825 | def delete(self, request, *args, **kwargs): |
822 | try: | 826 | try: |
823 | Project.objects.get(kwargs['project_id']).delete() | 827 | Project.objects.get(pk=kwargs['project_id']).delete() |
824 | except Project.DoesNotExist: | 828 | except Project.DoesNotExist: |
825 | return error_response("Project %s does not exist" % | 829 | return error_response("Project %s does not exist" % |
826 | kwargs['project_id']) | 830 | kwargs['project_id']) |
827 | return JsonResponse({"error": "ok"}) | 831 | return JsonResponse({ |
832 | "error": "ok", | ||
833 | "gotoUrl": reverse("all-projects", args=[]) | ||
834 | }) | ||