From dfb16f0c25d0ca9b880efc14467c4d234d905055 Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 3 Jul 2019 05:13:02 +0530 Subject: [PATCH] Save new user's hosting key only in that case --- datacenterlight/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 22294432..3763d465 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -848,10 +848,10 @@ class OrderConfirmationView(DetailView, FormView): new_user = authenticate(username=custom_user.email, password=password) login(request, new_user) - if 'new_user_hosting_key_id' in self.request.session: - user_hosting_key = UserHostingKey.objects.get(self.request.session['new_user_hosting_key_id']) - user_hosting_key.user = new_user - user_hosting_key.save() + if 'new_user_hosting_key_id' in self.request.session: + user_hosting_key = UserHostingKey.objects.get(id=self.request.session['new_user_hosting_key_id']) + user_hosting_key.user = new_user + user_hosting_key.save() owner = new_user manager = OpenNebulaManager(