Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rejestracja(request):
- username = ''
- email= ''
- password = ''
- username = request.POST.get('username')
- email = request.POST.get('email')
- password = request.POST.get('password')
- if request.method == 'POST':
- if not (User.objects.filter(username=username).exists() or User.objects.filter(email=email).exists()):
- User.objects.create_user(username, email, password)
- user = authenticate(username = username, password = password)
- login(request, user)
- return HttpResponseRedirect('/')
- else:
- raise forms.ValidationError("Looks like a user with that username or email already exists")
- return render(request, 'rejestracja.html')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement