diff --git a/CalibreWebCompanion/db.sqlite3 b/CalibreWebCompanion/db.sqlite3 index a609fcd..ce2c134 100644 Binary files a/CalibreWebCompanion/db.sqlite3 and b/CalibreWebCompanion/db.sqlite3 differ diff --git a/CalibreWebCompanion/library/forms.py b/CalibreWebCompanion/library/forms.py index 23ce394..319166a 100644 --- a/CalibreWebCompanion/library/forms.py +++ b/CalibreWebCompanion/library/forms.py @@ -1,7 +1,25 @@ from django import forms +from django.contrib.auth.forms import UserCreationForm +from django.contrib.auth.models import User + class SearchForm(forms.Form): title = forms.CharField(label="Title", max_length=200) author = forms.CharField(label='Author', max_length=100) # identifier = forms.CharField(label='Identifier(ISBN, Google-id, amazon id)', max_length=20) + + +class UserCreationForm(UserCreationForm): + email = forms.EmailField(required=True) + + class Meta: + model = User + fields = ("username", "email", "password1", "password2") + + def save(self, commit=True): + user = super(UserCreationForm, self).save(commit=False) + user.email = self.cleaned_data["email"] + if commit: + user.save() + return user diff --git a/CalibreWebCompanion/library/views.py b/CalibreWebCompanion/library/views.py index f6a174a..bacd1a0 100644 --- a/CalibreWebCompanion/library/views.py +++ b/CalibreWebCompanion/library/views.py @@ -2,10 +2,10 @@ from django.shortcuts import render from django.views import generic from .models import Author, Book, Comment, Rating, BookAuthorLink, Publisher, Tag, BookTagLink, BookRatingLink, Data from django.http import HttpResponseRedirect -from .forms import SearchForm +from .forms import SearchForm, UserCreationForm from django.db import models from django.db.models import Q -from django.contrib.auth.forms import UserCreationForm +# from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django.contrib.auth import login from django.contrib.auth.decorators import login_required