Refactor clearing all session variables
This commit is contained in:
parent
2fbee916cc
commit
5d9b2ee41a
1 changed files with 11 additions and 5 deletions
|
@ -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)
|
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',
|
for session_var in ['specs', 'template', 'billing_address',
|
||||||
'billing_address_data', 'card_id',
|
'billing_address_data', 'card_id',
|
||||||
'token', 'customer']:
|
'token', 'customer','generic_payment_type',
|
||||||
|
'generic_payment_details', 'product_id']:
|
||||||
if session_var in request.session:
|
if session_var in request.session:
|
||||||
del request.session[session_var]
|
del request.session[session_var]
|
Loading…
Reference in a new issue