Advanced: How to use href in Jinja2
You need to add the id into your URL path. One way to add the id (from the Python variable a.id
to your URL is to use the %
string formatting operator, like so:
<a href="{{ '/view_assessment_result/%s'%a.id }}">{{ a.id }}</a>
Also, if your a.id
might include special characters (/
, &
, etc), you can escape them via the urlencode
filter:
<a href="{{ '/view_assessment_result/%s'%a.id|urlencode }}">{{ a.id }}</a>