Refactor clearing all session variables

This commit is contained in:
PCoder 2018-10-05 10:36:13 +02:00
parent 2fbee916cc
commit 5d9b2ee41a

View file

@ -89,8 +89,14 @@ def create_vm(billing_address_data, stripe_customer_id, specs,
create_vm_task.delay(vm_template_id, user, specs, template, order.id)
clear_all_session_vars(request)
def clear_all_session_vars(request):
if request.session is not None:
for session_var in ['specs', 'template', 'billing_address',
'billing_address_data', 'card_id',
'token', 'customer']:
'token', 'customer','generic_payment_type',
'generic_payment_details', 'product_id']:
if session_var in request.session:
del request.session[session_var]