Beispiel #1
0
def add_comment():
    content = request.form['content']
    comment = Comment().create(content, g.user)
    db.add(comment)
    db.commit()

    return redirect(url_for('.view_comment'))
Beispiel #2
0
def reply_comment(refer_id):
    content = request.form['content']
    comment = Comment().create(content, g.user)
    comment['refer_id'] = refer_id
    db.add(comment)
    db.commit()

    return redirect(url_for('.view_comment'))
Beispiel #3
0
def delete_comment(id):
    comment = db.query(Comment, condition=lambda x: x['id'] == id, count=1)
    if not comment:
        abort(404)
    else:
        db.remove(comment[0])
        db.commit()
        return redirect(url_for('.view_comment'))
Beispiel #4
0
def create_visitor():
    v = User().create(**visitor)
    db.add(v)
    db.commit()
Beispiel #5
0
def create_admin():
    v = User().create("admin", "secret", role["admin"])
    db.add(v)
    db.commit()