Add: make userProfile on sign up
This commit is contained in:
parent
cc4523b427
commit
73b4e26372
1 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,10 @@
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.contrib.auth import authenticate, login
|
from django.contrib.auth import authenticate, login
|
||||||
|
|
||||||
|
#from django.contrib.auth.models import User
|
||||||
|
from apps.user.models import UserProfile
|
||||||
|
|
||||||
from .forms import LoginForm, SignUpForm
|
from .forms import LoginForm, SignUpForm
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +45,12 @@ def register_user(request):
|
||||||
username = form.cleaned_data.get("username")
|
username = form.cleaned_data.get("username")
|
||||||
raw_password = form.cleaned_data.get("password1")
|
raw_password = form.cleaned_data.get("password1")
|
||||||
user = authenticate(username=username, password=raw_password)
|
user = authenticate(username=username, password=raw_password)
|
||||||
|
|
||||||
|
#user = User.objects.create_user(username=username, password=raw_password)
|
||||||
|
|
||||||
|
# Create a UserProfile instance for the user
|
||||||
|
profile = UserProfile(user=user)
|
||||||
|
profile.save()
|
||||||
|
|
||||||
msg = 'User created - please <a href="/login">login</a>.'
|
msg = 'User created - please <a href="/login">login</a>.'
|
||||||
success = True
|
success = True
|
||||||
|
|
Loading…
Reference in a new issue