From 02a2ac31c620010c376611d1c979f46f73eb34db Mon Sep 17 00:00:00 2001 From: Levi Date: Sun, 21 May 2017 22:35:43 -0500 Subject: [PATCH] added next url to ssh create key view --- hosting/templates/hosting/virtual_machine_key.html | 4 ++++ hosting/views.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hosting/templates/hosting/virtual_machine_key.html b/hosting/templates/hosting/virtual_machine_key.html index 0ea4abe5..e152948d 100644 --- a/hosting/templates/hosting/virtual_machine_key.html +++ b/hosting/templates/hosting/virtual_machine_key.html @@ -113,6 +113,10 @@ {%endif%} +{% if next_url %} + window.location.href = '{{next_url}}' +{% endif %} + {%endblock%} diff --git a/hosting/views.py b/hosting/views.py index 8ab77a2a..ef1a9226 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -287,7 +287,6 @@ class GenerateVMSSHKeysView(LoginRequiredMixin, FormView): form_class = UserHostingKeyForm model = UserHostingKey template_name = 'hosting/virtual_machine_key.html' - success_url = reverse_lazy('hosting:orders') login_url = reverse_lazy('hosting:login') context_object_name = "virtual_machine" @@ -324,7 +323,8 @@ class GenerateVMSSHKeysView(LoginRequiredMixin, FormView): context.update({ 'private_key': form.cleaned_data.get('private_key'), 'key_name': form.cleaned_data.get('name'), - 'form': UserHostingKeyForm(request=self.request) + 'form': UserHostingKeyForm(request=self.request), + 'next_url': self.request.session.get('next', None) }) # return HttpResponseRedirect(reverse('hosting:key_pair'))