Example #1
0
def add_User(request):
    form = UserCreateForm()
    if request.method == "POST":
        form = UserCreateForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect("home")
    return render_to_response("add_User.html", {"form": form}, RequestContext(request))
Example #2
0
def add_User(request):
    form = UserCreateForm()
    if request.method == 'POST':
        form = UserCreateForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect('home')
    return render_to_response('add_User.html', {
        'form': form,
    }, RequestContext(request))
Example #3
0
File: views.py Project: CS2014/USM
def signup(request):
        if request.method == 'POST':
            user_form = UserCreateForm(request.POST)
            if user_form.is_valid():
                    username = user_form.clean_username()
                    password = user_form.clean_password2()
                    user_form.save()
                    user = authenticate(username=username, password=password)                   
                    login(request, user)
                    return redirect("/")
            else:
                return render(request,
                                    'main/signup.html',
                                    { 'form' : user_form })
        return render(request,
                            'main/signup.html')     
Example #4
0
def registro(request):
    form = UserCreateForm
    if request.method == 'POST':
        form = UserCreateForm(request.POST)
        if form.is_valid():
            user = form.save()
            UserProfile.objects.create(user=user)
            return redirect('login')
    return render_to_response('registro.html', {
        'form': form,
    }, RequestContext(request))