Answer the question
In order to leave comments, you need to log in
How to save user data after logout in Django?
Good afternoon!
I am writing a study project in Django. I wanted to limit authorized users to one comment per article.
Comments are open only to authorized users. Further, through the session, I made it possible to add only 1 comment per article - it works great. I logged out and logged in again - the session was updated, all restrictions on comments were also reset to zero, which upset me a lot.
I believed that this data is stored on the server and is associated with the user, and therefore, upon re-authorization, they are pulled up to it. I read about sessions and cookies - these are little-known concepts for me. And it seems that the loss of history in my case is the norm. But I still want to clarify:
1. Is it really possible to solve my problem (no more than 1 comment from a user per article) using sessions?
2. How to implement a full-fledged assignment of some information (comments or goods in the basket) to the user's login, regardless of his logging out and the devices used? Through an additional field in the user, where, for example, the id of the goods added to the cart are stored in the list?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question