Django OperationalError: table sampleapp_userprofile has no column named email - python

Git Repo
I'm a beginner in the Django. I tried to implement JWT inside Python but when I add a new user I get an error, which is as follows.
django.db.utils.OperationalError: table sampleapp_userprofile has no column named email
I have created the email field and also put the default value in the email field, and I still get this error .. I have provided the git repository and given some code below, please help.
models.py
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
# Create your models here.
class MyAccountManager(BaseUserManager):
def create_user(self, email, username, password=None):
if not email:
raise ValueError('Users must have an email address')
if not username:
raise ValueError('Users must have a username')
user = self.model(
email=self.normalize_email(email),
username=username,
)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email, username, password):
user = self.create_user(
email=self.normalize_email(email),
password=password,
username=username,
)
user.is_admin = True
user.is_staff = True
user.is_superuser = True
user.save(using=self._db)
return user
class UserProfile(AbstractBaseUser):
email = models.EmailField(verbose_name="email",max_length=60, unique=True,default='')
username = models.CharField(max_length=30,default='Null')
password = models.CharField(verbose_name='password',max_length=16)
last_login = models.DateTimeField(verbose_name='last login', auto_now=True)
objects = MyAccountManager()
USERNAME_FIELD = 'username'
EmailField = 'email'
REQUIRED_FIELDS = ['username']
def __str__(self):
return self.email
views.py
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status, generics
from rest_framework_simplejwt.views import TokenObtainPairView
from .serializers import *
from rest_framework.decorators import api_view
# Create your views here.
class LoginView(TokenObtainPairView):
"""
Login View with jWt token authentication
"""
serializer_class = MyTokenObtainPairSerializer
class registrationView(APIView):
def post(self,request,format=None):
if request.method == 'POST':
serializer = RegistrationSerializer(data=request.data)
data = {}
if serializer.is_valid():
account = serializer.save()
data['response'] = 'successfully registered new user.'
else:
data = serializer.errors
return Response(data)
serializers.py
from rest_framework import serializers, status
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from .models import UserProfile
from rest_framework_simplejwt.serializers import TokenObtainPairSerializer
from rest_framework_simplejwt.views import TokenObtainPairView
class MyTokenObtainPairSerializer(TokenObtainPairSerializer):
def validate(self, attrs):
print('in')
user = authenticate(username=attrs['username'], password=attrs['password'])
if user is not None:
if user.is_active:
data = super().validate(attrs)
refresh = self.get_token(self.user)
refresh['username'] = self.user.username
try:
obj = UserProfile.objects.get(user=self.user)
refresh['employeeRole'] = obj.employeeRole
data["refresh"] = str(refresh)
data["access"] = str(refresh.access_token)
data["employee_id"] = self.user.id
data['user_name']= self.user.username
data["employeeRole"] = obj.employeeRole
data['first_name']= self.user.first_name
data['last_name']= self.user.last_name
except Exception as e:
raise serializers.ValidationError('Something Wrong!')
return data
else:
raise serializers.ValidationError('Account is Blocked')
else:
raise serializers.ValidationError('Incorrect userid/email and password combination!')
class RegistrationSerializer(serializers.ModelSerializer):
email = serializers.EmailField(style={'input_type': 'email'})
username = serializers.CharField(min_length=1)
class Meta:
model = UserProfile
fields = ['email','username', 'password']
extra_kwargs = {
'password': {'write_only': True,'min_length':8},
}
def save(self):
account = UserProfile(
email=self.validated_data['email'],
username=self.validated_data['username'],
password=self.validated_data['password']
)
account.save()
return account

Related

DRF ImageField Inconsistent behavior

I'm creating a Django API with DRF. I have a custom User Model like this :
models.py :
from typing import Type, List
from uuid import uuid4
from django.db import models
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.base_user import AbstractBaseUser
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.models import TimeStampedModel
from main.apps.user.managers import UserManager
def to_profile_picture(instance: "User", filename: str) -> str:
return f"profile_pictures/{instance.email}/{uuid4()}_{filename}"
class User(AbstractBaseUser, TimeStampedModel, PermissionsMixin):
email = models.EmailField(_("Email Address"), unique=True)
first_name = models.CharField(
_("First Name"), max_length=128, blank=True, null=True
)
last_name = models.CharField(_("Last Name"), max_length=128, blank=True, null=True)
display_name = models.CharField(_("Display Name"), max_length=128)
is_active = models.BooleanField(_("Active"), default=True)
is_staff = models.BooleanField(_("Is staff"), default=False)
profile_picture = models.ImageField(
upload_to=to_profile_picture, null=True, blank=True
)
objects: Type[UserManager] = UserManager()
USERNAME_FIELD: str = "email"
REQUIRED_FIELDS: List[str] = []
class Meta:
verbose_name: str = _("User")
verbose_name_plural: str = _("Users")
#property
def get_full_name(self) -> str:
return f"{self.first_name} {self.last_name}"
managers.py :
from django.contrib.auth.base_user import BaseUserManager
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, email, password, **extra_fields):
"""
Creates and saves a User with the given email and password.
"""
if not email:
raise ValueError("The given email must be set")
email = self.normalize_email(email)
user = self.model(email=email, **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_user(self, email: str, password: str = None, **extra_fields):
extra_fields.setdefault("is_superuser", False)
extra_fields.setdefault("is_staff", False)
return self._create_user(email, password, **extra_fields)
def create_superuser(self, email, password, **extra_fields):
extra_fields.setdefault("is_superuser", True)
extra_fields.setdefault("is_staff", True)
if extra_fields.get("is_superuser") is not True:
raise ValueError("Superuser must have is_superuser=True.")
return self._create_user(email, password, **extra_fields)
viewsets.py :
from typing import Type
from rest_framework import viewsets, status
from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework.response import Response
from rest_framework.request import Request
from rest_framework.decorators import action
from main.apps.user.models import User
from main.apps.user.serializers import UserSerializer
class UsersViewset(viewsets.ModelViewSet):
def get_permissions(self):
"""
Instantiates and returns the list of permissions that this view requires.
"""
if self.action == "create":
permission_classes = [AllowAny]
else:
permission_classes = [IsAuthenticated]
return [permission() for permission in permission_classes]
queryset = User.objects.all()
serializer_class: Type[UserSerializer] = UserSerializer
def create(self, request, *args, **kwargs):
serializer: UserSerializer = UserSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
user = User.objects.create_user(
serializer.validated_data.pop("email"),
serializer.validated_data.pop("password"),
**serializer.validated_data,
)
return Response(status=status.HTTP_201_CREATED, data=UserSerializer(user).data)
#action(detail=False)
def me(self, request: Request):
return Response(
status=status.HTTP_200_OK, data=UserSerializer(request.user).data
)
serializers.py :
from typing import Type, Tuple, Dict, Any
from rest_framework import serializers
from main.apps.user.models import User
class UserSerializer(serializers.ModelSerializer):
class Meta:
model: Type[User] = User
fields: Tuple[str] = (
"id",
"email",
"password",
"display_name",
"first_name",
"last_name",
"profile_picture",
)
extra_kwargs: Dict[str, Any] = {"password": {"write_only": True}}
My issue here is that when I go to the route I defined for the UserViewset and trigger the list action, it returns the full URL with the http://domain/ in front of the file path, which is actually exactly what I want. But on the /me route or the create route, only the path is returned, without the domain.
I'm thinking it might have something to do with the context that is not passed to the serializer in custom routes, but might be in the default ModelViewset routes.
If anyone knows how I can replicate the list action behavior on my other routes, I'll be glad !
Okay, found out that it was what I thought, I just needed to pass the request as context to my serializer.
Change the method me in file viewsets.py from that :
#action(detail=False)
def me(self, request: Request):
return Response(
status=status.HTTP_200_OK, data=UserSerializer(request.user).data
)
to this :
#action(detail=False)
def me(self, request: Request):
return Response(
status=status.HTTP_200_OK,
data=UserSerializer(request.user, context={"request": request}).data,
)

Getting an error 'function' object has no attribute '_meta' django 2.0

trying to use login and registration with Django custom user using AbstractUserModel
Now getting this error during makemigrations
I am using Django 2.0.7 and python 3.6.6
models.py
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
class UserManager(BaseUserManager):
def create_user(self,email,full_name,password=None,is_active =
True,is_staff=False,is_admin=False):
if not email:
raise ValueError("Put an email address")
if not password:
raise ValueError("Input a password")
if not full_name:
raise ValueError("You must add your fullname")
user= self.model(
email=self.normalize_email(email),
fullname=full_name
)
user.set_password(password)
user.staff = is_staff
user.admin = is_admin
user.active = is_active
user.save(using=self._db)
return user
def create_staffuser(self,email,full_name,password=None):
user = self.create_user(
email,
full_name=full_name,
password=password,
is_staff=True
)
return user
def create_superuser(self,email,full_name=None,password=None):
user = self.create_user(
email,
full_name=full_name,
password=password,
is_staff=True,
is_admin=True
)
return user
class User(AbstractBaseUser):
email = models.EmailField(max_length=50,unique=True)
full_name = models.CharField(max_length=200,blank=True
active = models.BooleanField(default=True)
staff = models.BooleanField(default=False)
admin = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['full_name']
objects = UserManager()
def __str__(self):
return self.email
def get_full_name(self):
if self.full_name:
return self.full_name
return self.email
def has_perm(self, perm, obj = None):
return True
def has_module_perms(self, app_level):
return True
#property
def is_staff(self):
return self.staff
#property
def is_admin(self):
return self.admin
#property
def is_active(self):
return self.active
forms.py
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from .models import User
User = get_user_model
class UserAdminChangeForm(forms.ModelForm):
password = ReadOnlyPasswordHashField()
class Meta:
model = User
fields = ('email', 'full_name','password', 'active', 'admin')
def clean_password(self):
# Regardless of what the user provides, return the initial value.
# This is done here, rather than on the field, because the
# field does not have access to the initial value
return self.initial["password"]
class LoginForm(forms.Form):
email = forms.EmailField(label='email')
password = forms.CharField(widget=forms.PasswordInput)
class RegisterForm(forms.ModelForm):
"""A form for creating new users. Includes all the required
fields, plus a repeated password."""
password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
password2 = forms.CharField(label='Password confirmation',
widget=forms.PasswordInput)
class Meta:
model = User
fields = ('email','full_name',)
def clean_password2(self):
# Check that the two password entries match
password1 = self.cleaned_data.get("password1")
password2 = self.cleaned_data.get("password2")
if password1 and password2 and password1 != password2:
raise forms.ValidationError("Passwords don't match")
return password2
def save(self, commit=True):
# Save the provided password in hashed format
user = super(RegisterForm, self).save(commit=False)
user.set_password(self.cleaned_data["password1"])
user.active = True #send confirmation email
if commit:
user.save()
return user
views.py
from django.shortcuts import render, redirect
from django.views.generic import CreateView, FormView
from django.http import HttpResponse
from .forms import RegisterForm,LoginForm
from django.contrib.auth import authenticate,get_user_model,login
from django.utils.http import is_safe_url
# from django.contrib.auth.models import User
# from django.contrib.auth.decorators import login_required
# Create your views here.
class LoginView(FormView):
form_class = LoginForm
template_name = 'login.html'
success_url = '/' #will be the profile view
def form_valid(self):
request = self.request
next_ = request.GET.get('next')
next_post = request.POST.get('next')
redirect_path = next_ or next_post or None
email = form.cleaned_data.get('email')
password = form.cleaned_data.get('password')
user = authenticate(username=email, password=password)
if user is not None:
login(request, user)
try:
del request.session[]
except:
pass
if is_safe_url(redirect_path, request.get_host()):
return redirect(redirect_path)
else:
return redirect("/")
return super(LoginView,self).form_invalid()
class RegisterView(CreateView):
form_class = RegisterForm
template_name = 'registratiion.html'
success_url = '/login/'
I am sorry if I have posted anything unnecessary...
if you have any better solution please help me out...
You have missed out the parentheses to call the get_user_model method. It should be:
from django.contrib.auth import get_user_model
User = get_user_model()

Cannot login using email in django

I am trying to login using email instead of username in django, but it is not working. I am not getting any error also.
I also looked up solution for solutions in stackoverflow and other blogs/post also but not getting the output.
Can you please review my code where I am wrong/ modification needed.
Any suggestions or changes are welcome.
Here is my code:
models.py
from django.db import models
from django.contrib.auth.models import (BaseUserManager,AbstractBaseUser)
# Create your models here.
class UserManager(BaseUserManager):
def create_user(self, email,password=None):
"""
Creates and saves a User with the given email, date of
birth and password.
"""
if not email:
raise ValueError('Users must have an email address')
user = self.model(
email=self.normalize_email(email),
)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email, date_of_birth, password):
"""
Creates and saves a superuser with the given email, date of
birth and password.
"""
user = self.create_user(
email,
password=password,
)
user.is_admin = True
user.save(using=self._db)
return user
class MyUser(AbstractBaseUser):
email = models.EmailField(verbose_name='email address',
max_length=255,
unique=True,
)
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)
objects = UserManager()
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
def __str__(self):
return self.email
def has_perm(self, perm, obj=None):
"Does the user have a specific permission?"
# Simplest possible answer: Yes, always
return True
def has_module_perms(self, app_label):
"Does the user have permissions to view the app `app_label`?"
# Simplest possible answer: Yes, always
return True
#property
def is_staff(self):
"Is the user a member of staff?"
# Simplest possible answer: All admins are staff
return self.is_admin
views.py
from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model,authenticate
from .forms import RegisterForm,LoginForm
# Create your views here.
def home(request):
return render(request,'home.html',{})
def register_view(request):
form = RegisterForm(request.POST or None)
context = {"form":form}
if form.is_valid():
email = form.cleaned_data['email']
password = form.cleaned_data['password']
new_user = User.objects.create_user(email,password)
return render(request,'register.html',context)
def login_view(request):
form = LoginForm(request.POST or None)
context = {"form" : form}
if form.is_valid():
username = form.cleaned_data.get("username")
password = form.cleaned_data.get("password")
user = authenticate(request,username = username,password=password)
if user is not None:
login(request, user)
print("Looged In")
return redirect('home')
else:
print("Username or Password is Wrong")
return render(request,'login.html',context)
backends.py
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
class EmailBackend(ModelBackend):
def authenticate(self, username=None, password=None, **kwargs):
UserModel = get_user_model()
try:
user = UserModel.objects.get(email=username)
except UserModel.DoesNotExist:
return None
else:
if user.check_password(password):
return user
return None
settings.py
AUTHENTICATION_BACKENDS = ['profile_manager.backends.EmailBackend']
AUTH_USER_MODEL = 'profile_manager.MyUser'
forms.py
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.models import User
from .models import MyUser
User = get_user_model()
class RegisterForm(forms.Form):
email =forms.EmailField(widget = forms.TextInput(
attrs = {"class":"form-control",
"placeholder":"Email"
}),label='')
password = forms.CharField(widget =forms.PasswordInput(attrs = {"class":"form-control",
"placeholder":"Password"
}),label='')
password2 = forms.CharField(label ='' , widget = forms.PasswordInput(attrs = {"class":"form-control",
"placeholder":"Confirm Password"
}))
def clean_email(self):
email = self.cleaned_data.get('email')
qs = User.objects.filter(email =email)
if qs.exists():
raise forms.ValidationError("Email is already taken")
return email
def clean(self):
data =self.cleaned_data
password = self.cleaned_data.get('password')
password2 = self.cleaned_data.get('password2')
if password2!= password:
raise forms.ValidationError("Password must match")
return data
class LoginForm(forms.Form):
email = forms.EmailField(widget = forms.TextInput(
attrs = {"class":"form-control",
"placeholder":"Username"
}),label='')
password = forms.CharField(widget =forms.PasswordInput(attrs = {"class":"form-control",
"placeholder":"Password"
}),label='')
This line in your login_view can't be right:
username = form.cleaned_data.get("username")
Your form doesn't have a username field, it only has an email field.

"AnonymousUser" Error When Non-Admin Users Log In - Django

When I try to login users registered through my AbstractBaseUser model I get the error:
'AnonymousUser' object has no attribute '_meta'
Which highlights the code:
login(request, user)
However, if the user is an admin there is no problem, leaving me to believe that the problem isn't with the 'login_view', but a problem with how the user is tagged (so to speak) when they are registered with AbstractBaseUser.
Any help would be much appreciated!
Here is my code:
Models.py
from django.db import models
from django.contrib.auth.models import (
AbstractBaseUser, BaseUserManager, PermissionsMixin
)
class UserManager(BaseUserManager):
def create_user(self, first_name, last_name, email, password=None, is_active=True, is_staff=False, is_admin=False):
if not first_name:
raise ValueError("Users must enter their first name")
if not last_name:
raise ValueError("Users must enter their last name")
if not email:
raise ValueError("Users must enter an email")
if not password:
raise ValueError("Users must enter a password")
user_obj = self.model(
first_name = first_name,
last_name = last_name,
email = self.normalize_email(email),
)
user_obj.set_password(password) #set and change password?
user_obj.admin = is_admin
user_obj.staff = is_staff
user_obj.active = is_active
user_obj.save(using=self._db)
return user_obj
def create_superuser(self, first_name, last_name, email, password=None):
user = self.create_user(
first_name,
last_name,
email,
password=password,
is_staff=True,
is_admin=True
)
return user
class User(AbstractBaseUser, PermissionsMixin):
first_name = models.CharField(max_length=255, blank=True, null=True)
last_name = models.CharField(max_length=255, blank=True, null=True)
email = models.EmailField(max_length=255, unique=True)
timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
active = models.BooleanField(default=True) #can login
staff = models.BooleanField(default=False) #staff not superuser
admin = models.BooleanField(default=False) #superuser
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['first_name', 'last_name']
objects = UserManager()
def __str__(self):
return self.email
def get_first_name(self):
return self.email
def get_last_name(self):
return self.email
def get_short_name(self):
return self.email
def has_perm(self, perm, obj=None):
return True
def has_module_perms(self, app_label):
return True
#property
def is_staff(self):
return self.staff
#property
def is_admin(self):
return self.admin
#property
def is_active(self):
return self.active
Forms.py
from django import forms
from django.contrib.auth import (
authenticate,
get_user_model,
login,
logout,
)
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.contrib.auth.models import User, Group
User = get_user_model()
class UserAdminCreationForm(forms.ModelForm):
password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
class Meta:
model = User
fields = ('first_name', 'last_name', 'email')
def save(self, commit=True):
user = super(UserAdminCreationForm, self).save(commit=False)
user.set_password(self.cleaned_data["password1"])
if commit:
user.save()
return user
class UserAdminChangeForm(forms.ModelForm):
password = ReadOnlyPasswordHashField()
class Meta:
model = User
fields = ('email', 'first_name', 'last_name', 'password', 'admin')
def clean_password(self):
return self.initial["password"]
class LoginForm(forms.Form):
username = forms.CharField(label='Email')
password = forms.CharField(widget=forms.PasswordInput)
Views.py
from django.shortcuts import render
from django.contrib.auth.models import User, Group
from django.contrib.auth import (
authenticate,
get_user_model,
login,
logout,
)
from django.shortcuts import redirect
from .forms import UserAdminCreationForm, LoginForm
def register_view(request):
form = UserAdminCreationForm(request.POST or None)
if form.is_valid():
user = form.save(commit=False)
password = form.cleaned_data.get('password')
user.set_password(password)
user.save()
user.groups.add(Group.objects.get(name='customers'))
login(request, user)
context = {
"form": form,
}
return render (request, "register.html", context)
def login_view(request):
form = LoginForm(request.POST or None)
if form.is_valid():
username = form.cleaned_data.get("username")
password = form.cleaned_data.get("password")
user = authenticate(username=username, password=password)
login(request, user)
context = {
"form": form,
}
return render (request, "login.html", context)
Try using the methods that the BaseClass provides. That will prevent you from making unexpected errors.
You can use super() for that purpose.

Authenticating a Django user with email

I'm using Django 1.7 and am trying to authenticate a user with email instead of the provided Django auth user.
This is my models.py
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
class MyUserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must have an email address')
user = self.model(
email=MyUserManager.normalize_email(email),
)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email, password):
user = self.create_user(email,
password=password,
)
user.is_admin = True
user.save(using=self._db)
return user
class MyUser(AbstractBaseUser):
"""
Custom user class.
"""
email = models.EmailField('email address', unique=True, db_index=True)
joined = models.DateTimeField(auto_now_add=True)
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
def __unicode__(self):
return self.email
and this is a snippet from my views.py
def auth_view(request):
username = request.POST.get('username', '')
password = request.POST.get('password', '')
user = auth.authenticate(username=username, password=password)
if user is not None:
auth.login(request, user)
return HttpResponseRedirect('/')
else:
return HttpResponseRedirect('/invalid/')
def register_user(request):
if request.method == 'POST':
form = MyRegistrationForm(request.POST)
if form.is_valid():
print "Form is valid"
form.save()
return HttpResponseRedirect('/register_success/')
args = {}
args.update(csrf(request))
args['form'] = MyRegistrationForm()
return render_to_response('register.html', args, context_instance=RequestContext(request))
and finally, my forms.py
from django import forms
from django.contrib.auth.models import User
class MyRegistrationForm(forms.ModelForm):
"""
Form for registering a new account.
"""
email = forms.EmailField(widget=forms.EmailInput,label="Email")
password1 = forms.CharField(widget=forms.PasswordInput,
label="Password")
password2 = forms.CharField(widget=forms.PasswordInput,
label="Password (again)")
class Meta:
model = User
fields = ['email', 'password1', 'password2']
def clean(self):
"""
Verifies that the values entered into the password fields match
NOTE: Errors here will appear in ``non_field_errors()`` because it applies to more than one field.
"""
cleaned_data = super(MyRegistrationForm, self).clean()
if 'password1' in self.cleaned_data and 'password2' in self.cleaned_data:
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError("Passwords don't match. Please enter both fields again.")
return self.cleaned_data
def save(self, commit=True):
user = super(MyRegistrationForm, self).save(commit=False)
user.set_password(self.cleaned_data['password1'])
if commit:
user.save()
return user
Whenever I try to register an account, I get an error 'NoneType' object has no attribute '_insert' from forms.py calling user.save and views.py calling form.save. I don't really know how to write the user.save, but I'd imagine that would fix both errors.
Can anyone help me?
look at forms.py imports
from django.contrib.auth.models import User
must import MyUser instead of that
same in
class Meta:
model = User
fields = ['email', 'password1', 'password2']
and add to MyUser class
objects = MyUserManage()
change to
class Meta:
model = MyUser
fields = ['email', 'password1', 'password2']
and settings.py must set:
AUTH_USER_MODEL = '<apppath>.MyUser'

Categories

Resources