def add_person(): p = Person() p.p_name = "Sam %d" % random.randrange(100) db.session.add(p) db.session.commit() return 'Person add Success'
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))
def add_person(): person = Person() person.p_name = '我喜欢的人%d' % random.randrange(100) person.p_age = random.randrange(100) db.session.add(person) db.session.commit() return 'Add Sucess'
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('创建人员成功')
def person_add(request): # 添加人 person = Person() person.p_name = "呵呵哒%d" % random.randrange(1000) person.p_age = 180 # 存储 person.save() return HttpResponse("添加成功%d" % person.id)
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('批量插入成功')
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("创建成功!")
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('批量创建成功')
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)
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')
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("批量创建成功")
def add_person(): p = Person() p.p_age = 15 p.p_name = "二狗" # 存到数据库 db.session.add(p) db.session.commit() return 'su'
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")
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!")
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("批量创建成功!")
def add_person(): p = Person() p.p_name = '洪泽飞%d' % (random.randrange(100)) # 将数据添加到本次数据库的链接会话中 db.session.add(p) # 提交会话 db.session.commit() return 'Person Create Success '
def add_person(): """添加成员""" p = Person() p.p_name = "小朋友%d号" % random.randrange(100) db.session.add(p) db.session.commit() return 'Person Add Success'
def add_persons(): persons = [] for i in range(5): p = Person() p.p_name = 'haha%d' % random.randrange(100) p.p_age = random.randrange(100) persons.append(p) # 添加一组 # db.session 会话,和数据库链接的会话 db.session.add_all(persons) db.session.commit() print(persons) return '添加成功'
def add_person(): p = Person() p.p_name = '谁着了拉出去枪毙%d' % random.randrange(100) db.session.add(p) db.session.commit() return 'Person Add Success'
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))
def add_person(request): person = Person() person.p_name = '小明%d' % random.randrange(1000) person.save() return HttpResponse('用户创建成功%d' % person.id)