Python - Flask method call inside if statement

I am new to flask. I am trying to call a method defined in the python file. The method is setup properly in the python file (tested). Now in the HTML file I want to call this method within an if statement. So in Java it would be something like:

if (allowAccess() == 1){...}

I have tried the following:

{% if {{ allowAccess() }} == 1 %}

            <p>test message</p>

{% endif %}

But i get the error:

expected token : got }

1 answer

  • answered 2017-06-17 18:31 Raja Simon

    You don't have to put {{ inside the conditional templates statement... So answering the question would be...

    {% if allowAccess() == 1 %}