Пример #1
0
def threads_open(threadId):

    # List(4 elements): [0] Thread.id, [1] Thread.topic, [2] Thread.created, [3] Thread.modified
    threadData = Thread.get_thread(threadId)

    # List of list(6 elements): [0] Account.id, [1] Account.username, [2] Post.id, [3] Post.message, [4] Post.created, [5] Post.modified
    postsData = Post.get_posts_in_thread(threadId)

    return render_template("threads/open.html",
                           threadData=threadData,
                           postsData=postsData)
Пример #2
0
def threads_remove(threadId):
    postsData = Post.get_posts_in_thread(threadId)

    for row in postsData:
        dbPost = Post.query.get(row[2])
        db.session().delete(dbPost)

    dbThread = Thread.query.get(threadId)
    db.session().delete(dbThread)

    db.session().commit()
    return redirect(url_for("threads_index"))