Пример #1
0
def create_test_posts():
    p1 = Post("Test Post", "test_post")
    p1.add_category("Testing", "テスト中")
    p1.add_tags("test;experiment", "テスト;実験")
    p1.add_body("This is a test post.", "これはテストの書き込みです。")
    p1.published = True
    p1.date = datetime.now() - timedelta(hours=p1.get_tz_offset())
    db.session.add(p1)
    db.session.commit()
    p2 = Post("Another Test Post", "another_test_post")
    p2.add_category("Testing Another")
    p2.add_tags("test;experiment")
    p2.add_body("This is another test post.")
    db.session.add(p2)
    db.session.commit()