Hello I have a problem with a select/option html where you can select the page number, so page 1 of 100, 2 of 200 etc... and then goes to page 1, 2, 3 ...
Everything works in the following code apart from the fact that inside the select button, after clicking on the page you want to go, after refreshing the page, it goes back to page 1, it always shows: page 1 of 100, even if actually in the url the page number is correct. I should use a session variable, but the problem is that I'm struggling to understand how to use it with Flask/Jinja2 directly in the html page. Someone can help?
using {% set session['page'] = page %}
and then {{ session['page'] }}
it gives me syntax error:
TemplateSyntaxError: expected token 'end of statement block', got '['
{% set session['page'] = page %}
<select onchange="window.location.href=this.value">
{%- for page in range (1,(form.total_PAGE.data | int) + 1 ) %}
<option value="{{ page }}">{{ session['page'] }}/{{ form.total_PAGE.data }}</option>
{%- endfor %}
</select>