Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplify the standlone login form.

It now reuses the {% login_form %} template tag.
  • Loading branch information...
commit c95521a6c802aba0185a4b868d1575e67ed2083c 1 parent 567c699
@malcolmt authored
View
2  static/css/style.layout.css
@@ -35,7 +35,7 @@ input {
padding-right: 0.5em;
}
-#login-form {
+.hidden {
display: none;
}
View
8 user_management/templates/user_management/login.html
@@ -1,11 +1,7 @@
{% extends "base.html" %}
+{% load auth_tags %}
{% block content %}
-<form action="" method="post">{% csrf_token %}
- <table>
- {{ form }}
- <tr><td></td><td><input type="submit" value="Login" /></td></tr>
- </table>
-</form>
+{% login_form "visible" %}
{% endblock %}
View
2  user_management/templates/user_management/login_form.html
@@ -1,4 +1,4 @@
-<form id="login-form" action="{% url login %}" method="post">
+<form id="login-form" {% if hidden %}class="hidden"{% endif %} action="{% url login %}" method="post">
{% csrf_token %}
<table>
{{ form }}
View
7 user_management/templatetags/auth_tags.py
@@ -4,6 +4,9 @@
register = template.Library()
@register.inclusion_tag("user_management/login_form.html")
-def login_form():
- return {"form": forms.AuthenticationForm()}
+def login_form(style=None):
+ context = {"form": forms.AuthenticationForm()}
+ if style != "visible":
+ context["hidden"] = True
+ return context
Please sign in to comment.
Something went wrong with that request. Please try again.