Is it possible to store data just for a single session in Django (Database, Cookies)?

Hi there,

I am quite new to Django and I just came across the following question and would be very happy if someone can help me there:

I want to store data the user enters (a string, for example a name or the user’s age), BUT it must be “deleted” when the same user enters the website again after closing it so is should only be saved for the current session.

So I read about cookies in Django but they actually DO store the data of a session to be used again in the next.

So does anyone know a way to store data for a single session in Django?

Thanks a lot in advance

Sounds like you want to use the django sessions system: How to use sessions | Django documentation | Django

Does this fit your problem?

1 Like

Yes, it does, thank you. I have seen that before but somehow I didn’t read that correctly :slight_smile: Thank you very much

1 Like