Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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))