SHARE
TWEET

Untitled

a guest Apr 2nd, 2019 37 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def signup(request):
  2.     if request.method=="POST":
  3.         form=UserCreationForm(request.POST)
  4.         if form.is_valid():
  5.             user=form.save()
  6.             username=form.cleaned_data.get('username')
  7.             raw_password=form.cleaned_data.get('password1')
  8.             user=authenticate(username=username,password=raw_password)
  9.             login(request,user)
  10.             return redirect('main:dashboard')
  11.         else:
  12.             for msg in form.error_messages:
  13.                 print(form.error_messages[msg])
  14.     form=UserCreationForm()
  15.     return render(request,"signup.html",{"form":form})
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top