Django template -TemplateSyntaxError
I am a beginner in Django world. When I try render my login.html template I'm facing this problem even there is a closing block.
TemplateSyntaxError at /login/ Invalid block tag on line 12: 'else', expected 'endblock'. Did you forget to register or load this tag?`
Here is my template
{% extends 'base.html' %}
{% block content %}
{% if not request.user.is_authenticated %}
<div style="margin-top: 30px">
<form method="POST">
{% csrf_token %} {% if error %}
<p style="color: red">{{error}}</p>
{% endif %}
<div>
<input type="text" name="username" placeholder="username" />
</div>
<div>
<input type="password" name="password" placeholder="password" />
</div>
<button type="submit">Login</button>
</form>
</div>
{% else %}
<p>
You're already logged in. Would you like to <a href="/logout/"> logout?</a>
</p>
{% endif %}
{% endblock content%}