I have simple jinja2 template with registration/login links, I should hide them when user logged in, I also use flask_login module for this stuff.
Question is: How should I identify is user logged in in jinja2 templates?
Flask leverages Jinja2 as its template engine. You are obviously free to use a different template engine, but you still have to install Jinja2 to run Flask itself. This requirement is necessary to enable rich extensions.
Jinja, also commonly referred to as "Jinja2" to specify the newest release version, is a Python template engine used to create HTML, XML or other markup formats that are returned to the user via an HTTP response.
Flask-Login adds the current_user variable to your templates:
{% if current_user.is_authenticated %} ... {% else %} ... {% endif %} They mention this briefly in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With