Link 并在点击图片时将 jinja2 中的列表条目重定向到路由
Link and redirect a list entry in jinja2 to a route when picture is clicked
我正在尝试将图像重定向到具有位置 x[1] 的列表中的用户标识(用户)的页面。
我不能使用 {{ x[1] }} 传递用户吗?
<a href="{{ url_for('getprofile'), user= {{ x[1] }})">
<img class="img-responsive" src=" {{x[0]}}" >
</a>
我收到错误:
<a href="{{ url_for('getprofile'), user= {{ x[1] }})">
jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got '='
我做错了什么?
直接使用变量 {{ }}
.
<a href="{{ url_for('getprofile', user=x[1]) }}">
<img class="img-responsive" src="{{ x[0] }}">
</a>
我正在尝试将图像重定向到具有位置 x[1] 的列表中的用户标识(用户)的页面。 我不能使用 {{ x[1] }} 传递用户吗?
<a href="{{ url_for('getprofile'), user= {{ x[1] }})">
<img class="img-responsive" src=" {{x[0]}}" >
</a>
我收到错误:
<a href="{{ url_for('getprofile'), user= {{ x[1] }})">
jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got '='
我做错了什么?
直接使用变量 {{ }}
.
<a href="{{ url_for('getprofile', user=x[1]) }}">
<img class="img-responsive" src="{{ x[0] }}">
</a>