Beispiel #1
0
def add(topic_id):
	u = current_user()
	if not u:
		return redirect(url_for("auth.login"))
	Reply.new_and_save(request.form)
	t = Topic.find_by_id(topic_id)
	update_comments(t)
	return redirect(url_for("topic.detail", topic_id=topic_id))
Beispiel #2
0
def detail(topic_id):
    t = Topic.find_by_id(topic_id)
    u = current_user()
    rs = Reply.find_by(topic_id=topic_id)
    update_views(t)
    rs.sort(key=lambda x: x.floor)
    floor_count = len(rs) + 1
    return render_template("topic/detail.html",
                           topic=t,
                           user=u,
                           replies=rs,
                           floor_count=floor_count)