Example #1
0
def create_post():
    post = request.form
    post_dict = {
        'user': post['user'],
        'write_date': get_current_date(),
        'title': post['title'],
        'contents': post['contents']
    }
    mongo.insert_one(mongo_conn, post_dict)
    return render_template('index.html',
                           board_dict=mongo.find_boards(mongo_conn))
Example #2
0
def edit_post():
    post = request.form
    post_id = post['post_id']
    post_dict = {
        'user': post['user'],
        'write_date': post['write_date'],
        'title': post['title'],
        'contents': post['contents']
    }
    mongo.update_boards(mongo_conn, post_id, post_dict)
    return render_template('index.html',
                           board_dict=mongo.find_boards(mongo_conn))
Example #3
0
def del_post(post_id):
    mongo.del_boards(mongo_conn, post_id)
    return render_template('index.html',
                           board_dict=mongo.find_boards(mongo_conn))
Example #4
0
def template_posts(post_id):
    board_dict = dict()
    boards = mongo.find_boards(mongo_conn)
    if post_id in boards:
        board_dict = boards[post_id]
    return render_template('post.html', board_dict=board_dict, post_id=post_id)
Example #5
0
def template_boards():
    return render_template('index.html',
                           board_dict=mongo.find_boards(mongo_conn))