示例#1
0
 def post(self, request):
     form = forms.SignUpForm(request.POST)
     if form.is_valid():
         user = form.save()
         login(request, user)
         return redirect('/')
     context = {"form": form}
     return render(request, 'auth/signup.html', context)
示例#2
0
    def post(self, request):
        form = forms.SignUpForm(request.POST)
        if form.is_valid():
            next = request.GET.get('next', '/blog')
            user = form.save()
            login(request, user)
            return HttpResponseRedirect(next)

        context = {
            'form': form,
        }
        return render(request, 'auth/signup.html', context)
 def get(self, request):
     context = {"form": forms.SignUpForm()}
     return render(request, 'auth/signup.html', context)