Exemplo n.º 1
0
def index(request):
    """
    主页的处理函数, 返回主页的响应
    """
    u = current_user(request)
    body = Template.render('index.html', username=u.username)
    return html_response(body)
Exemplo n.º 2
0
def index(request):
    result = request.query.get('result', '')
    result = unquote_plus(result)
    u = current_user(request)
    todos = Todo.all()
    # 替换模板文件中的标记字符串
    body = Template.render('todo_index.html', todos=todos, result=result)
    return html_response(body)
Exemplo n.º 3
0
def index(request):
    """
    weibo 首页的路由函数
    """
    u = current_user(request)
    weibos = Weibo.find_all(user_id=u.id)
    log('weiboall', weibos)
    # 替换模板文件中的标记字符串
    body = Template.render('weibo_index.html', weibos=weibos)
    return html_response(body)
Exemplo n.º 4
0
def edit(request):
    user_id = int(request.query['id'])
    u = User.find_by(id=user_id)
    cu = current_user(request)

    body = Template.render(
        'user_edit.html',
        username=cu.username,
        user=u,
    )
    return html_response(body)
Exemplo n.º 5
0
def login_view(request):
    u = current_user(request)
    result = request.query.get('result', '')
    result = unquote_plus(result)

    body = Template.render(
        'user_login.html',
        username=u.username,
        result=result,
    )
    return html_response(body)
Exemplo n.º 6
0
def admin(request):
    result = request.query.get('result', '')
    result = unquote_plus(result)

    u = current_user(request)
    us = User.all()

    body = Template.render(
        'user_admin.html',
        username=u.username,
        users=us,
        result=result,
    )
    return html_response(body)
Exemplo n.º 7
0
def index(request):
    """
    weibo 首页的路由函数
    """
    body = Template.render('weibo_index.html')
    return html_response(body)
Exemplo n.º 8
0
def register_view(request):
    result = request.query.get('result', '')
    result = unquote_plus(result)

    body = Template.render('user_register.html', result=result)
    return html_response(body)
Exemplo n.º 9
0
def edit():
    weibo_id = int(request.query['id'])
    w = Weibo.find_by(id=weibo_id)
    body = Template.render('weibo_edit.html', weibo=w)
    return html_response(body)
Exemplo n.º 10
0
def edit(request):
    todo_id = int(request.query['id'])
    t = Todo.find_by(id=todo_id)
    body = Template.render('todo_edit.html', todo=t)
    return html_response(body)