display login status Section 11, Lecture 50

ログイン状態か表示する方法 f:id:yukking3:20180506193846p:plain

app/catalog/templates/layout.htmlに以下を追記する。

<a href="">
    {% if current_user.is_authenticated %}
        Logged-In as <b style="color: deeppink"> {{ current_user.user_name.title() }} </b>
    {% else %}
        Not Logged-In
    {% endif %}
</a>

実際にやってみる f:id:yukking3:20180506194024p:plain ログイン状態の場合 f:id:yukking3:20180506194056p:plain