From 981e68aa4f94c372f979d00d4051b75a4058bf6c Mon Sep 17 00:00:00 2001 From: PCoder Date: Wed, 23 Dec 2020 13:56:08 +0530 Subject: [PATCH] Fix getting card_id and compare --- datacenterlight/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 613fac26..d6fb5303 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -1117,8 +1117,8 @@ def do_create_vm(request, user, stripe_api_cus_id, card_details_response, user_hosting_key.save() logger.debug("User %s key is saved" % custom_user.email) - if 'card_id' in request: - card_id = request.get('card_id') + card_id = request.get('card_id', None) + if card_id: logger.debug("card_id %s was in request" % card_id) user_card_detail = UserCardDetail.objects.get(id=card_id) card_details_dict = {