Exemplo n.º 1
0
def add_student(request):

    student = Student()
    student.s_name = 'Jerry%d' % random.randrange(100)
    student.save()

    return HttpResponse('添加成功:%s' % student.s_name)
Exemplo n.º 2
0
def add_student(request):

    student = Student()
    student.s_name = 'Jerry%d' % random.randrange(100)
    student.save()

    return HttpResponse('add student %s complete!' % student.s_name)
Exemplo n.º 3
0
def add_student(request):

    student = Student()
    student.s_name = 'Jerry%d' % random.randrange(200)
    student.save()

    return HttpResponse('Add success %s 添加成功!' % student.s_name)
Exemplo n.º 4
0
def add_student(request):

    student = Student()
    student.s_name = 'Jerry%d' % random.randrange(100)
    student.save()

    return HttpResponse("<h1>Add Success %s</h1>" % student.s_name)
Exemplo n.º 5
0
def student_add(request):
    student = Student()
    flag = random.randrange(300)
    student.s_name = "小黄%d" % flag
    student.s_age = flag
    grade = Grade.objects.last()
    student.s_grade = grade
    student.save()
    return HttpResponse("学生创建%d" % student.id)
Exemplo n.º 6
0
def add_student(request):
    s = Student()
    s.s_name = 'intro%d' % random.randrange(200)
    s.s_age = random.randrange(17, 36)

    g = Grade.objects.last()
    s.s_grade = g
    s.save()

    return HttpResponse('创建学生成功%d' % s.id)
Exemplo n.º 7
0
def add_student(request):
    for i in range(10):
        student = Student()
        student.s_name = f'Jerry{i}'
        student.s_age = random.randint(10, 100)
        student.save()
    return HttpResponse("Add success")
Exemplo n.º 8
0
def add_student(request):

    s_name = request.POST.get("学生名字")
    s_grade = request.POST.get("班级ID")
    student = Student()
    student.s_name = s_name
    student.s_grade_id = int(s_grade)
    student.save()
    return HttpResponse("新增学生成功")
Exemplo n.º 9
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.º 10
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.º 11
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("注册成功 ")
Exemplo n.º 12
0
def addstudent(request):
    student = Student()
    student.s_name = 'Jerry-%d' % random.randrange(100)
    student.save()

    return HttpResponse("Add Successs %s" % student.s_name)
Exemplo n.º 13
0
def add_student(request):
    student = Student()
    student.s_name = 'jerry%s' % random.randrange(0, 100)
    student.s_age = random.randrange(0, 100)
    student.save()
    return HttpResponse('add success')
Exemplo n.º 14
0
def add(request):
    student = Student()
    student.s_name = 'Jerry-%d' % random.randrange(10000)
    student.s_age = random.randrange(100)
    student.save()
    return HttpResponse("add students %s success " % student.s_name)
Exemplo n.º 15
0
def add_student(request):
    # ORM management on database
    student = Student()
    student.s_name = "Jerry%d" % random.randrange(100)
    student.save()
    return HttpResponse('add success %s' % student.s_name)
Exemplo n.º 16
0
def add_student(request):
    student = Student()
    student.s_name = 'Jerry'
    student.s_age = 19
    student.save()
    return HttpResponse('add success %s' % student.s_name)