I have a flask project which, when the user logs in, I save a value if he has ‘mesa’ access:
session['user_name'] = user.name
this variable stores 0 or 1. Then, on the sidebar menu in my app, if mesa is equals 1, then the user has access to some pages. It happens that in every path I have to call it and pass to the pages:
@app.route('/newclient', methods=["GET", "POST"])
def newclient():
[...]
mesa = session.get('mesa')
return render_template("newclient.html", ..., mesa=mesa)
I am using a ‘base.html’ to call {% extends "base.html" %}
on templates and this sidebar menu is on the ‘base.html’ file. This is getting difficult to track as my routes are increasing in number. Is there an easier way to store and recover this value?