Modifying Dictionary in Django Session Does Not Modify Session

As the documentation states, another option is to use


which will make this happen every request anyway. Might be worth it if this happens a lot in your code; I’m guessing the occasional additional overhead wouldn’t be much and it is far less than the potential problems from neglecting from including the

request.session.modified = True

line each time.

Leave a Comment