I'm trying to restrict access to regular users so that a part of my website is only accessible to administrators. I would like the server to render specific content based on the role of the visiting user.
I'm using the Flask framework and a few of its modules. This is what I have:
{% extends 'admin/master.html' %}
{% if True %}
{% block body %}
<p>Welcome Admin!</p>
<a href="/">Back Home</a>
{% endblock %}
{% else %}
{% block page_body %}
<h1>Forbidden!</h1>
{% endblock page_body %}
{% endif %}
I'm planning to use the if statement to render different content but I was baffled to see the following response:
Has anyone any suggestions on why it is rendering the 'else' block?
This is my requirements.txt:
requests
wtforms
flask
flask_sqlalchemy
flask_wtf
flask-bcrypt
flask-login
Pillow
flask-admin
flask-principal
Thanks for your help!