'Django Session Variable Is Accessible Even After Deletion

I tried to delete the session after the work is complete. But, it still shows a different value when checking if the session variable exists.

if 'order_id' in request.session:
    # here the value of session variable is 28
    del request.session['order_id']
    request.session.modified = True

When I checked again it returned True even though I deleted the variable,

if 'order_id' in request.session:
    # here the value of session variable is 5118
    print('yes')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source