2021的特普通奖
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
579 B

  1. from app import Story, Paragraph, db
  2. from datetime import datetime
  3. db.drop_all()
  4. db.create_all()
  5. BEGIN_WORDS = [("候选%d的标题" % (i + 1), "%d个故事的示例开头" % (i + 1)) for i in range(10)]
  6. for idx, (t, w) in zip(range(10), BEGIN_WORDS):
  7. s = Story(id=idx, title=t, text=w, tail=idx,
  8. avatar="https://bbs.pku.edu.cn/v2/images/user/portrait-anony.png")
  9. p = Paragraph(id=idx, text=w, story_id=idx, is_chosen=True,
  10. author="初始设定", time=datetime.now())
  11. db.session.add(s)
  12. db.session.add(p)
  13. db.session.commit()