예제 #1
0
파일: views.py 프로젝트: BrianSpry/website
def createuser(request):
    if request.method == 'POST':
        form = BrianUserRegistration(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/accounts/registration_complete')
     
    arguments = {}
    arguments['form'] = BrianUserRegistration()
    arguments.update(csrf(request))
    return render_to_response('createuser.html', arguments)
예제 #2
0
파일: views.py 프로젝트: BrianSpry/website
def createuser(request):
    if request.method == 'POST':
        form = BrianUserRegistration(request.POST)
        if form.is_valid():
            new_user = form.save()
            new_user = authenticate(username=request.POST['username'],password=request.POST['password1'])
            login(request, new_user)
            return HttpResponseRedirect('/accounts/profile')
        else:
            return render_to_response('createuser.html', {'form': form},context_instance=RequestContext(request))
        
    arguments = {}
    arguments['form'] = BrianUserRegistration()
    arguments.update(csrf(request))
    return render_to_response('createuser.html', arguments,context_instance=RequestContext(request))