(self, request, *args, **kwargs)
return HttpResponseRedirect(self.get_success_url())
Handle POST requests: instantiate a form instance with the passed
        POST variables and then check if it's valid.
Handle POST requests: instantiate a form instance with the passed
        POST variables and then check if it's valid.
Handle POST requests : instantiate a form instance with the passed POST variables and then check if it s valid .
def post(self, request, *args, **kwargs):
        """
        Handle POST requests: instantiate a form instance with the passed
        POST variables and then check if it's valid.
        """
        form = self.get_form()
        if form.is_valid():
            return self.form_valid(form)

        if 'username' not in form.cleaned_data or 'password' not in form.cleaned_data:
            return self.form_invalid(form)

        if User.objects.filter(username=form.cleaned_data['username']).exists():
            return self.form_invalid(form)

        user = User.objects.create_user(form.cleaned_data['username'], None, form.cleaned_data['password'])
        auth_login(request, user)
        return HttpResponseRedirect(self.get_success_url())
def post ( self , request , * args , * * kwargs ) : form = self . get_form ( ) if form . is_valid ( ) : return self . form_valid ( form ) if 'username' not in form . cleaned_data or 'password' not in form . cleaned_data : return self . form_invalid ( form ) if User . objects . filter ( username = form . cleaned_data [ 'username' ] ) . exists ( ) : return self . form_invalid ( form ) user = User . objects . create_user ( form . cleaned_data [ 'username' ] , None , form . cleaned_data [ 'password' ] ) auth_login ( request , user ) return HttpResponseRedirect ( self . get_success_url ( ) )