added email field to signup
This commit is contained in:
parent
cce3b1e733
commit
caa3022cdf
Binary file not shown.
@ -1,7 +1,25 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
|
||||||
class SearchForm(forms.Form):
|
class SearchForm(forms.Form):
|
||||||
title = forms.CharField(label="Title", max_length=200)
|
title = forms.CharField(label="Title", max_length=200)
|
||||||
author = forms.CharField(label='Author', max_length=100)
|
author = forms.CharField(label='Author', max_length=100)
|
||||||
# identifier = forms.CharField(label='Identifier(ISBN, Google-id, amazon id)', max_length=20)
|
# 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
|
||||||
|
@ -2,10 +2,10 @@ from django.shortcuts import render
|
|||||||
from django.views import generic
|
from django.views import generic
|
||||||
from .models import Author, Book, Comment, Rating, BookAuthorLink, Publisher, Tag, BookTagLink, BookRatingLink, Data
|
from .models import Author, Book, Comment, Rating, BookAuthorLink, Publisher, Tag, BookTagLink, BookRatingLink, Data
|
||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from .forms import SearchForm
|
from .forms import SearchForm, UserCreationForm
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
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.models import User
|
||||||
from django.contrib.auth import login
|
from django.contrib.auth import login
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
Loading…
Reference in New Issue
Block a user