Answers for "signup django"

0

signup view

from django.contrib.auth import authenticate

class SignUpView(CreateView):
    form_class 		= UserRegistrationForm
    success_url 	= reverse_lazy('home')
    template_name	= 'registration/signup.html'
    
    def form_valid(self, form):
        view        = super(SignUpView, self).form_valid(form)
        username    = form.cleaned_data.get('username')
        password    = form.cleaned_data.get('password1')
        user        = authenticate(username=username, password=password)       
        login(self.request, user)
        return view
Posted by: Guest on September-16-2020
0

django sign up

def signup(request):
    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            username = form.cleaned_data.get('username')
            password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=password)
            login(request, user)
            return redirect('home')
Posted by: Guest on September-21-2020

Python Answers by Framework

Browse Popular Code Answers by Language