Esempio n. 1
0
 def test_adds(self):
     session.add_all([
         Menu(title='orderManage'),
         Menu(title='vipManage', url='/user1', parent_id=1),
         Menu(title='friend', url='/user2', parent_id=1)
     ])
     session.commit()
Esempio n. 2
0
 def post(self):
     stu_list = list()
     for i in range(10):
         stu = Student()
         stu.s_name = 'xiaomi_%s' % i
         stu_list.append(stu)
     session.add_all(stu_list)
     session.commit()
     self.write('新增多条数据成功')
Esempio n. 3
0
 def test_adds(self):
     session.add_all([
         Menu(title='订单管理'),
         Menu(title='会员管理', url='/user', parent_id=1),
         Menu(title='派件员', url='/user2', parent_id=1),
         Menu(title='合作商', url='/user3', parent_id=1),
         Menu(title='订单统计', url='/order_cnt', parent_id=2),
     ])
     session.commit()
Esempio n. 4
0
 def test_add(self):
     # m1 = Menu(title='用户管理')
     # session.add(m1)
     session.add_all([
         Menu(title='订单管理'),
         Menu(title='会员管理', url='/user1', parent_id=1),
         Menu(title='派件员', url='/user2', parent_id=1),
         Menu(title='合作商', url='/user3', parent_id=1),
         Menu(title='订单统计', url='/order_cnt', parent_id=2)
     ])
     session.commit()
Esempio n. 5
0
 def post(self):
     # stu = Student(s_name="扛把子",s_age=18)
     # session.add(stu)
     # session.commit()
     stus = []
     for i in range(100):
         stu = Student()
         stu.s_name = 'qf_%s' % i
         stu.s_age = i
         stus.append(stu)
     session.add_all(stus)
     session.commit()
     self.write("新增数据成功")
    def post(self):
        # 创建单条数据
        # stu = Student()
        # stu.s_name = '小明'
        # session.add(stu)
        # session.commit()

        # 创建多条数据
        stus = []
        for i in range(10):
            stu = Student()
            stu.s_name = '小明_%s' % i
            stus.append(stu)

        session.add_all(stus)
        session.commit()
        self.write('新增数据成功')