How to set session variable in Django template

Viewed 20

How to set session variable within Django template, For example:

<a href="{% url 'view' request.session.data.set("First data") %}">First Button</a>
<a href="{% url 'view' request.session.data.set("Second data") %}">Second Button</a>
<a href="{% url 'view' request.session.data.set("Third data") %}">Third Button</a>

The Reason of doing this in the template not in the view: by clicking a certain button on the page the user should be redirected with different session data (that depends on the button being clicked)

The Reason of not doing this with GET parameters: The data is sensitive

0 Answers
Related