Exemple #1
0
def addperson(request):
    per = Person()
    per.p_name = '阿童木-' + str(random.randrange(10000000))
    per.p_age = random.randrange(10, 100000)
    per.save()

    return HttpResponse('{}已满16岁!'.format(per.p_name))
Exemple #2
0
def add_persons(request):
    for i in range(10):
        p = Person()
        p.p_name = '啥子%d' % random.randrange(100)
        p.p_age = random.randrange(200)
        p.save()

        return HttpResponse('创建人员成功')
Exemple #3
0
def person_add(request):
    # 添加人
    person = Person()
    person.p_name = "呵呵哒%d" % random.randrange(1000)
    person.p_age = 180
    # 存储
    person.save()
    return HttpResponse("添加成功%d" % person.id)
Exemple #4
0
def add_persons(request):
    for i in range(15):
        person = Person()
        flag = random.randrange(100)
        person.p_name = 'Tom%d' % i
        person.p_age = flag
        person.p_sex = flag % 2
        person.save()
    return HttpResponse("创建成功!")
Exemple #5
0
def add_person(request):

    username = request.GET.get("username")

    person = Person()
    person.p_name = username
    person.save()

    return HttpResponse("Person%d created success!" % person.id)
Exemple #6
0
def add_persons(request):
    for i in range(15):
        person = Person()
        flag = random.randrange(1000)
        person.p_name = 'Tom {}'.format(flag)
        person.p_age = flag
        person.p_sex = True
        person.save()
    return HttpResponse('create successfully')
Exemple #7
0
def add_persons(request):
    for i in range(15):
        person = Person()
        jia = random.randrange(100)
        person.p_name = "jia%d" % i
        person.p_age = jia
        person.p_sex = jia % 2
        person.save()
    return HttpResponse("批量创建成功")
Exemple #8
0
def add_person(request):
    # person = Person.objects.create(p_name="Sunck", p_age=15, p_sex=True)

    # 是"" ,不是 None Null, 不能重写 __init__ ,可以通过其他手段,实现属性自定义赋值
    person = Person(p_age=28)

    person = Person.create('Jack')
    person.save()
    return HttpResponse("Jack 创建成功")
Exemple #9
0
def add_persons(request):
    for i in range(15):
        person = Person()
        flag = random.randrange(100)
        person.p_name = "tom%d" % i
        person.p_age = flag
        person.p_sex = flag % 2
        person.save()
    return HttpResponse('批量插入成功')
Exemple #10
0
def add_persons(request):
    for i in range(10):
        person = Person()
        flag = random.randint(15, 45)
        person.p_name = 'Tom%d' % i
        person.p_age = flag
        person.p_sex = flag % 2
        person.save()
    return HttpResponse('批量创建成功')
Exemple #11
0
def add_persons(request):
    """一次性新增了多个数据库字段。"""
    for i in range(15):
        peo = Person()
        flag = random.randrange(1000000)
        peo.p_name = "tom-%d" % i
        peo.p_age = flag
        peo.p_sex = flag % 2
        peo.save()
    return render(request, "add_PS.html")
Exemple #12
0
def add_persons(request):
    for i in range(15):
        person = Person()
        flag = random.randrange(100)
        person.p_name = "Tom%d" % i
        person.p_age = flag
        person.p_sex = flag % 2
        person.save()

    return HttpResponse("batch downloading!")
Exemple #13
0
def add_persons(request):
    '''批量创建人'''
    for i in range(15):
        person = Person()
        flag = random.randrange(100)
        person.p_name = "Tom%d" % i
        person.p_age = flag
        person.p_sex = flag % 2
        person.save()
    return HttpResponse("批量创建成功!")
Exemple #14
0
def addperson(request):
    per = Person()
    per.p_name = 'gui_' + str(random.randrange(50))
    per.p_age = random.randrange(1,101)
    per.save()
    return HttpResponse('{}符合条件,加进去了'.format(per.p_name))
Exemple #15
0
def add_person(request):
    person = Person()
    person.p_name = '小明%d' % random.randrange(1000)

    person.save()
    return HttpResponse('用户创建成功%d' % person.id)
Exemple #16
0
def add_person():
    p = Person()
    p.name = "姬野%s" % random.randrange(1000)
    p.save()

    return "add person success"