Created
August 7, 2018 10:00
-
-
Save martin-martin/b642467f0c03d1555dd30f9b589cc2ab to your computer and use it in GitHub Desktop.
Django templates: show authentication links depending on user authentication status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>nameme</title> | |
</head> | |
<body> | |
<nav> | |
<!-- below block allows to show/hide authentication info | |
depending on user's authentication status --> | |
{% if not user.is_authenticated %} | |
<a href="/signup">Sign Up</a> | |
<a href="/login">Log In</a> | |
{% endif %} | |
{% if user.is_authenticated %} | |
<a href="/logout">Log Out</a> | |
{% endif %} | |
</nav> | |
{% block content %} | |
{% endblock content %} | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment