db_seeder.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Ulatwiaczek 作者: Marucik 项目源码 文件源码
def handle(self, *args, **options):
        number = options['count'][0]
        fake = Factory.create('pl_PL')
        for i in range(number):
            nauczyciel = Nauczyciel(None, fake.first_name().encode('ascii','ignore'), fake.last_name().encode('ascii','ignore'))
            nauczyciel.save()

            nazwaPrzedmiotu = fake.job().encode('ascii','ignore')
            przedmiot = Przedmiot(None, nazwaPrzedmiotu, nazwaPrzedmiotu[0:3])
            przedmiot.save()

            test = Test(None, random.randint(1, Przedmiot.objects.all().count()), random.randint(5, 15), random.randint(20, 40),fake.sentence(nb_words=6, variable_nb_words=True) ,datetime.date.today(), datetime.date.today(), True)
            test.save()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号