Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

signup class

class SignUpView(generic.CreateView):
    form_class 			= UserCreationForm
    success_url 		= reverse_lazy('login')
    template_name		= 'registration/signup.html'
    
    def form_valid(self, form):
        view        = super(SignUp, 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
 
PREVIOUS NEXT
Tagged: #signup #class
ADD COMMENT
Topic
Name
2+6 =