mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-17 05:11:07 +00:00
add a basic style for login form
This commit is contained in:
parent
ecaa2ebef0
commit
1aa9a02957
3 changed files with 69 additions and 19 deletions
20
djadmin2/static/themes/bootstrap/css/login.css
Normal file
20
djadmin2/static/themes/bootstrap/css/login.css
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
body{
|
||||
margin-top: 100px;
|
||||
}
|
||||
.form-container {
|
||||
float: none;
|
||||
margin: 0 auto;
|
||||
width: 400px;
|
||||
}
|
||||
.login-title{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
body{
|
||||
margin-top: 0px;
|
||||
}
|
||||
.form-container {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,27 +3,57 @@
|
|||
{% load i18n %}
|
||||
{% load admin2_tags %}
|
||||
|
||||
{% block css %}
|
||||
{{ block.super }}
|
||||
<link href="{{ STATIC_URL }}themes/bootstrap/css/login.css" rel="stylesheet" media="screen">
|
||||
{% endblock css %}
|
||||
|
||||
{% block navbar %}{% endblock navbar %}
|
||||
{% block breacrumbs %}{% endblock breacrumbs %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{% if form.errors %}
|
||||
<p class="error-note">
|
||||
{% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% block class_page_title %}span12 login-title{% endblock class_page_title %}
|
||||
{% block page_title %}{% trans "Site administration" %} - Login{% endblock page_title %}
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<input type="hidden" name="this_is_the_login_form" value="1" />
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
<button class="btn btn-small btn-success" type="submit">
|
||||
{% trans "Log in" %}
|
||||
</button>
|
||||
</form>
|
||||
{% block content %}
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="well form-container">
|
||||
<form method="post" class="">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% if form.errors and not form.non_field_errors and not form.this_is_the_login_form.errors %}
|
||||
<p class="alert alert-error fade in">
|
||||
<button data-dismiss="alert" class="close" type="button">×</button>
|
||||
{% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if form.non_field_errors or form.this_is_the_login_form.errors %}
|
||||
{% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
|
||||
<p class="alert alert-error fade in">
|
||||
<a href="#" data-dismiss="alert" class="close">×</a>
|
||||
{{ error }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<div class="control-group {% if form.username.errors %}error{% endif %}">
|
||||
<label for="id_{{ form.username.html_name }}" class="control-label">{{ form.username.label }}: </label>
|
||||
<input type="text" class="span12" name="{{ form.username.html_name }}" id="id_{{ form.username.html_name }}" class=" focused" value="{% firstof form.username.value "" %}">
|
||||
</div>
|
||||
<div class="control-group {% if form.password.errors %}error{% endif %}">
|
||||
<label for="id_{{ form.password.html_name }}" class="control-label">{{ form.password.label }}: </label>
|
||||
<input type="password" class="span12" name="{{ form.password.html_name }}" id="id_{{ form.password.html_name }}" value="">
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="this_is_the_login_form" value="1" />
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
<button class="btn btn-small btn-primary pull-right" type="submit">
|
||||
{% trans "Log in" %}
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@
|
|||
{% endif %}
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="span10">
|
||||
<div class="row-fluid">
|
||||
<div class="{% block class_page_title %}span10{% endblock class_page_title %}">
|
||||
<h3>{% block page_title %}{% trans "Site administration" %}{% endblock page_title %}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue