示例#1
0
文件: api.py 项目: jianingy/rssboard
def list_post():
    order_by = request.args.get('order_by', 'recent')
    if order_by == 'recent':
        order_by = 'posted_at desc'
    elif order_by == 'best':
        order_by = 'up desc'
    elif order_by == 'worst':
        order_by = 'down desc'
    elif order_by == 'most':
        order_by = 'visit desc'
    posts = post_service.list(order_by=order_by)
    return map(lambda x: dict(x), posts)
示例#2
0
def most():
    posts = post_service.list(order_by='visit asc')
    return render_template("index.html", posts=posts)
示例#3
0
def worst():
    posts = post_service.list(order_by='down desc')
    return render_template("index.html", posts=posts)
示例#4
0
def recent():
    posts = post_service.list(order_by='posted_at desc')
    return render_template("index.html", posts=posts)