Example #1
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("创建成功!")
Example #2
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')
Example #3
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("批量创建成功")
Example #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('批量插入成功')
Example #5
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('批量创建成功')
Example #6
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")
Example #7
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!")
Example #8
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("批量创建成功!")