Beispiel #1
0
def delete_blog():
    """Delete blog.
    :param id: blog id.
    """
    blog_id = request.json.get('blog_id', None)
    api_blog.delete(api_blog.get_or_404(blog_id))
    return jsonify(dict(success=True))
Beispiel #2
0
def audit_blog():
    can_publish = request.json.get('can_publish', None)
    blog_id = request.json.get('blog_id', None)
    if can_publish is None or blog_id is None:
        return jsonify(dict(success=False, message=u'操作有误,不要乱搞哦'))
    blog = api_blog.get_or_404(blog_id)
    api_blog.update(blog, can_publish=can_publish)
    return jsonify(dict(success=True))
Beispiel #3
0
def delete_blog(blog_id):
    """Delete blog.
    :param id: blog id.
    """
    blog = api_blog.get(blog_id)
    if blog.user != current_user:
        return jsonres(rv=None, metacode=403, msg=u'这不是您的,你不能删除', code=403)

    api_blog.delete(api_blog.get_or_404(blog_id))
    return jsonres()
Beispiel #4
0
def detail_blog(blog_id, category):
    blog = api_blog.get_or_404(blog_id)
    api_blog.update(blog, read_count=blog.read_count + 1)
    return render_template('blog/detail.html', blog=blog, category=category)
Beispiel #5
0
def detail_blog(blog_id):
    blog = api_blog.get_or_404(blog_id)
    return jsonres(rv=dict(id=blog.id, title=blog.title, content=blog.content, create_at=mkmillseconds(blog.create_at)))