Beispiel #1
0
def generate_fake_date():
    form = dict(
        username='******',
        password='******',
    )
    u = User.register(form)

    form = dict(
        username='******',
        password='******',
    )
    u = User.register(form)

    # form = dict(
    #     username='******',
    #     password='******',
    # )
    # u = User.register(form)

    form = dict(title='all')
    b = Board.new(form)
    with open('markdown_demo.md', encoding='utf8') as f:
        content = f.read()
    topic_form = dict(title='markdown demo', board_id=b.id, content=content)

    for i in range(10):
        print('begin topic <{}>'.format(i))
        t = Topics.new(topic_form, u.id)

        reply_form = dict(
            content='reply test',
            topic_id=t.id,
        )
        for j in range(5):
            Replys.new(reply_form, u.id)
Beispiel #2
0
def add():
    form = request.form.to_dict()
    u = current_user()
    Topics.new(form, user_id=u.id)
    return redirect(url_for('.index'))