示例#1
0
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)
示例#2
0
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)
示例#3
0
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())
示例#4
0
文件: routes.py 项目: feng409/u-bbs
def setting():
    """
    用户设置页
    """
    return render_template('user/setting.html', token=new_csrf_token())
示例#5
0
文件: routes.py 项目: feng409/u-bbs
def register():
    user = current_user()
    if user:
        return redirect('/')

    return render_template('user/register.html', token=new_csrf_token())
示例#6
0
文件: routes.py 项目: feng409/u-bbs
def login():
    user = current_user()
    if user:
        return redirect('/')
    return render_template('user/login.html', token=new_csrf_token())
示例#7
0
文件: routes.py 项目: feng409/u-bbs
def index():
    token = new_csrf_token()
    return render_template('tab/index.html',
                           token=token)
示例#8
0
def add():
    token = new_csrf_token()
    tabs = Tab.find_all()
    return render_template('topic/add.html', token=token, tabs=tabs)