70👍
✅
You can delete the key from the session like any other dictionary.
del request.session['your key']
You may need to mark the session as modified for it to save, depending on some of your settings.
request.session.modified = True
30👍
You could also pop the key from the session. You could set the key to a variable and get rid of it at the same time:
key_variable = request.session.pop('your key')
- [Django]-Django template filters, tags, simple_tags, and inclusion_tags
- [Django]-Django: How can I protect against concurrent modification of database entries
- [Django]-Get the list of checkbox post in django views
- [Django]-Django REST Framework and FileField absolute url
- [Django]-Cron and virtualenv
- [Django]-How to break "for loop" after 1 iteration in Django template
Source:stackexchange.com