Exemplo n.º 1
0
def moment(page=1):
    """
    动态列表页面
    :return:
    """
    if request.method == 'GET':
        moments = Moment.get_moments(page=page, limit=10)
        print(moments)
        latest_posts = Post.get_latest_posts(5)
        return render_template("home/moment.html",
                               moments=moments,
                               latest_posts=latest_posts)
Exemplo n.º 2
0
def search(page=1):
    from app.function.config import get_config
    pagination = get_home_search_paginate(
        page=page,
        per_page=int(get_config("web_home_posts_pages")),
        query=request.args.get('query'))
    latest_posts = Post.get_latest_posts(5)
    return render_template('home/index.html',
                           posts=pagination.items,
                           latest_posts=latest_posts,
                           pagination=pagination,
                           current_index='index')
Exemplo n.º 3
0
def category(category_sub_name, page=1):
    from app.function.config import get_config
    pagination = get_home_category_paginate(
        page=page,
        per_page=int(get_config("web_home_posts_pages")),
        category_sub_name=category_sub_name)
    latest_posts = Post.get_latest_posts(5)
    return render_template(
        'home/index.html',
        current_category=category_sub_name,
        posts=pagination.items,
        latest_posts=latest_posts,
        pagination=pagination,
    )
Exemplo n.º 4
0
def index(page=1):
    from app.function.config import get_config
    pagination = get_home_index_paginate(page=page, per_page=int(get_config("web_home_posts_pages")))
    latest_posts = Post.get_latest_posts(limit=3)
    return render_template('home/index.html', posts=pagination.items
                           , latest_posts=latest_posts, pagination=pagination, current_index='index')