def detail(id): t = Topic.get(id) replies = Reply.find_all(topic_id=t.id) token = new_csrf_token() return render_template('topic/detail.html', token=token, topic=t, replies=replies)
def edit(id): token = new_csrf_token() topic = Topic.find_by(id=id) tabs = Tab.find_all() log('edit topic:', topic) return render_template('topic/add.html', topic=topic, token=token, tabs=tabs)
def index(): tabs = Tab.find_all() if 'tab' in request.args and request.args.get('tab'): tab_title = request.args.get('tab') tab = Tab.find_by(title=tab_title) topic_list = Topic.find_all(tab_id=tab.id) else: tab_title = '' topic_list = Topic.find_all() return render_template('index.html', topic_list=topic_list, tabs=tabs, tab_title=tab_title, token=new_csrf_token())
def setting(): """ 用户设置页 """ return render_template('user/setting.html', token=new_csrf_token())
def register(): user = current_user() if user: return redirect('/') return render_template('user/register.html', token=new_csrf_token())
def login(): user = current_user() if user: return redirect('/') return render_template('user/login.html', token=new_csrf_token())
def index(): token = new_csrf_token() return render_template('tab/index.html', token=token)
def add(): token = new_csrf_token() tabs = Tab.find_all() return render_template('topic/add.html', token=token, tabs=tabs)