Exemplo n.º 1
0
def show_page(num):
    p = Page(num, per_page, Post.find().count())
    p.urlfunc = lambda num: url_for("blog.show_page", num=num)
    if not p.exists:
        abort(404)
    posts = Post.find({"is_published": True}).order_by("-timestamp")[p.slice()]
    return render_template("blog/index.html", posts=posts, page=p)
Exemplo n.º 2
0
def post_list(count=20):
    page = Page(int(request.args.get('page', 1)), count, Post.find().count())
    posts = Post.find().order_by("-timestamp")[page.slice()]
    module = post
    title = "Blog posts"
    subtitle = "latest first"
    return render_template("blog/admin/post_list.html", **locals())
Exemplo n.º 3
0
def show_page(num):
    p = Page(num, per_page, Post.find().count())
    p.urlfunc = lambda num: url_for("blog.show_page", num=num)
    if not p.exists:
        abort(404)
    posts = Post.find({"is_published": True}).order_by("-timestamp")[p.slice()]
    return render_template("blog/index.html", posts=posts, page=p)
Exemplo n.º 4
0
def post_list(count=20):
    page = Page(int(request.args.get('page', 1)), count, Post.find().count())
    posts = Post.find().order_by("-timestamp")[page.slice()]
    module = post
    title = "Blog posts"
    subtitle = "latest first"
    return render_template("blog/admin/post_list.html", **locals())
Exemplo n.º 5
0
def show_page(num):
    p = Page(num, per_page, Entry.find().count())
    if not p.exists:
        abort(404)
    p.urlfunc = lambda n: url_for("stream.show_page", num=n)
    entries = Entry.find().order_by("-timestamp")[p.slice()]
    return render_template("stream/index.html", entries=entries, page=p)
Exemplo n.º 6
0
def comment_list(count=25):
    page = Page(int(request.args.get('page', 1)), count, Comment.find().order_by("-timestamp").count())
    comments = Comment.find().order_by("-timestamp")[page.slice()]
    module = comment
    return render_template("comments/admin/comment_list.html", **locals())
Exemplo n.º 7
0
def ajax_page(num):
    p = Page(num, per_page, Entry.find().count())
    if not p.exists:
        abort(404)
    entries = Entry.find().order_by("-timestamp")[p.slice()]
    return dumps([e.rendered for e in entries], indent=2, sort_keys=True)