Exemplo n.º 1
0
def register(request):
    if request.method == 'GET':
        return render(request, 'student_register.html')
    elif request.method == 'POST':
        username = request.POST.get('username')
        password = request.POST.get('password')
        try:
            student = Student()
            student.s_name = username
            student.s_password = password
            student.save()
        except Exception as e:
            return redirect(reverse('two.register'))
        return HttpResponse('register successfully')
Exemplo n.º 2
0
def register(request):
    if request.method == "GET":
        return render(request, 'student_register.html')
    elif request.method == "POST":
        username = request.POST.get("username")
        password = request.POST.get("password")
        try:
            student = Student()
            student.s_name = username
            student.s_password = password
            student.save()
        except Exception as e:
            return redirect(reverse("two:register"))

        return HttpResponse("注册成功")
Exemplo n.º 3
0
def register(request):
    if request.method == "GET":
        return render(request, 'student_register.html')
    elif request.method == 'POST':
        username = request.POST.get('username')
        password = request.POST.get('password')

        try:
            student = Student()
            student.s_name = username
            student.s_password = password
            student.s_token = 'default'
            student.save()
            print('success')

        except Exception as e:
            print('sss')
            return redirect(reverse('two:register'))

        return HttpResponse("注册成功 ")