Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

signup

class SignUpView(CreateView):
    form_class 			= UserCreationForm
    success_url 		= reverse_lazy('login')
    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
Source by gist.githubusercontent.com #
 
PREVIOUS NEXT
Tagged: #signup
ADD COMMENT
Topic
Name
2+9 =