Everfighting
6/1/2017 - 7:46 AM

faker快速制造django假数据

faker快速制造django假数据

from faker import Factory

fake = Factory.create()
for i in range(100):
     c = CusQuestions(
         que_no = fake.text(max_nb_chars=90),
         loan_no = fake.text(max_nb_chars=90),
     )
     c.save()
     
# 安装pip install faker
# 以上代码放入models中 
# 写入对应类和对应字段,指定数据类型
# 运行python manage.py runserver