0
我得到解析,當我試圖從神社模板多個參數傳遞錯誤:Jinja2的url_for多個arguements jinja2.exceptions.TemplateSyntaxError:預計令牌「」,有‘:’
jinja2.exceptions.TemplateSyntaxError:預計令牌 '',有 ':'
@classmethod
def follow_user(cls, followed_email, follower_email):
with CursorFromConnectionFromPool() as cursor:
cursor.execute('INSERT INTO connections(follower_id, followee_id) VALUES (%s, %s)',
(follower_email,followed_email))
@classmethod
def unfollow_user(cls, followed_email, follower_email):
with CursorFromConnectionFromPool() as cursor:
cursor.execute("DELETE from connections WHERE follower_id = '{}' AND followee_id = '{}' ",
(follower_email, followed_email))
{% if is_following %}
<a class="btn btn-danger" href="{{ url_for('user.unfollow_user',followed_email:followed.email,follower_email:follower_email) }}" role="button">Unfollow</a>
{% else %}
<a class="btn btn-success" href="{{url_for('user.follow_user',followed_email:followed.email,follower_email:follower_email) }}" role="button">Follow</a>
{% endif %}
關鍵字參數使用'=',而不是':'。 'followed_email = followed.email' – davidism