fmartingr
/
shelfzilla
Archived
1
0
Fork 0

Using username instead of email again.

Fixes #3
This commit is contained in:
Felipe Martin 2014-04-24 17:29:56 +02:00
parent 93f6ffc571
commit 34c0a73cdb
5 changed files with 12 additions and 15 deletions

View File

@ -30,11 +30,11 @@ admin.site.register(Series, SeriesAdmin)
class VolumeAdmin(reversion.VersionAdmin):
list_display_links = ('number', )
list_display = ('series', 'number', )
# list_display_links = ('number', )
list_display = ('series', 'number', 'release_date',)
search_fields = ('number', 'series__name', )
list_filter = ('series', )
list_editable = ('series', )
# list_filter = ('series', )
# list_editable = ('series', )
admin.site.register(Volume, VolumeAdmin)

View File

@ -4,18 +4,18 @@ from django.utils.translation import ugettext_lazy as _
class LoginForm(forms.Form):
email = forms.EmailField(max_length=75)
username = forms.CharField(max_length=75, label=_('Username'))
password = forms.CharField(
max_length=255, widget=forms.PasswordInput)
max_length=255, widget=forms.PasswordInput, label=_('Password'))
def authenticate(self):
result = None
if self.cleaned_data:
email = self.cleaned_data['email']
username = self.cleaned_data['username']
password = self.cleaned_data['password']
result = authenticate(username=email, password=password)
result = authenticate(username=username, password=password)
return result

View File

@ -32,7 +32,6 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
# Longer username to use the email!
'longerusername',
# Admin

View File

@ -17,7 +17,7 @@ body {
position: absolute;
text-align: center;
top: 50%;
width: 300px;
width: @width;
}
/* Alternative behaviours for bootstrap */

View File

@ -24,21 +24,19 @@ $(function(){
<h3 class="panel-title">{% trans "Access the site" %}</h3>
</div>
<div class="panel-body">
<form method="post" class="form form-horizontal">
<form method="post" class="form">
{% csrf_token %}
{% for field in login_form %}
<div class="form-group {% if field.errors %}has-error has-feedback{% endif %} form-horizontal">
{% for error in field.errors %}
<p><span class="label label-danger">{{ error|striptags }}</span></p>
{% endfor %}
<label class="col-sm-2 control-label">{{ field.label }}</label>
<div class="col-sm-offset-2 col-sm-8 field-{{ field.html_name }}">
<div class="form-group {% if field.errors %}has-error has-feedback{% endif %}">
<label class="control-label">{{ field.label }}</label>
<input type="{{ field.field.widget.input_type }}" name="{{ field.html_name }}" class="form-control {{ field.classes }}" />
{% if field.errors %}
<span class="glyphicon glyphicon-remove form-control-feedback"></span>
{% endif %}
</div>
</div>
{% endfor %}
<button class="btn btn-primary" type="submit">{% trans "Login" %}</button>
</form>