From 1dfe1d7cf83a3d4575ab4ab2aa589ebf1c690f3e Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Fri, 29 Sep 2017 21:53:02 +0200 Subject: [PATCH] Redirect to my virtual machines page if any error --- hosting/views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hosting/views.py b/hosting/views.py index c0a4cb15..ca215a4d 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -1003,6 +1003,7 @@ class VirtualMachineView(LoginRequiredMixin, View): return redirect(reverse('hosting:virtual_machines')) elif self.request.is_ajax(): return HttpResponse() + context = None try: serializer = VirtualMachineSerializer(vm) context = { @@ -1012,7 +1013,11 @@ class VirtualMachineView(LoginRequiredMixin, View): } except Exception as ex: logger.debug("Exception generated {}".format(str(ex))) - pass + messages.error(self.request, + _('We could not find the requested VM. Please ' + 'contact Data Center Light Support.') + ) + return redirect(reverse('hosting:virtual_machines')) return render(request, self.template_name, context)