コード例 #1
0
def star(id):
    post = Post.query.get_or_404(id)
    if current_user.staring(post):
        flash('你已经收藏了这篇文章,不能重复收藏')
        return redirect(url_for('.post', id=post.id))
    current_user.star(post)
    flash('收藏成功')
    return redirect(url_for('.post', id=post.id))
コード例 #2
0
def unstar(id):
    post = Post.query.get_or_404(id)
    if not current_user.staring(post):
        flash('你没有收藏这边文章,不能取消收藏')
        return redirect(url_for('.post', id=post.id))
    current_user.unstar(post)
    flash('取消收藏成功')
    return redirect(url_for('.post', id=post.id))
コード例 #3
0
def deletestar(id):
    post = Post.query.get_or_404(id)
    if not current_user.staring(post):
        flash('你没有收藏这篇文章')
        return redirect(url_for('.starposts', username=current_user.username))
    current_user.unstar(post)
    flash('你不再收藏这篇旷世奇文了,太可惜了,你与大牛失之交臂')
    return redirect(url_for('.starposts', username=current_user.username))
コード例 #4
0
def unstar(id):
    post = Post.query.get_or_404(id)
    if not current_user.staring(post):
        flash('你没有收藏这篇文章')
        return redirect(url_for('.post', id=post.id))
    current_user.unstar(post)
    flash('你不再收藏这篇旷世奇文了,太可惜了,你与大牛失之交臂')
    return redirect(url_for('.post', id=post.id))
コード例 #5
0
ファイル: views.py プロジェクト: huihui7987/blog-1
def deletestar(id):
    post=Post.query.get_or_404(id)
    if not current_user.staring(post):
        flash('你没有收藏这篇文章')
        return redirect(url_for('.starposts',username=current_user.username))
    current_user.unstar(post)
    flash('你不再收藏这篇旷世奇文了,太可惜了,你与大牛失之交臂')
    return redirect(url_for('.starposts',username=current_user.username))
コード例 #6
0
ファイル: views.py プロジェクト: huihui7987/blog-1
def unstar(id):
    post=Post.query.get_or_404(id)
    if not current_user.staring(post):
        flash('你没有收藏这篇文章')
        return redirect(url_for('.post',id=post.id))
    current_user.unstar(post)
    flash('你不再收藏这篇旷世奇文了,太可惜了,你与大牛失之交臂')
    return redirect(url_for('.post',id=post.id))
コード例 #7
0
ファイル: views.py プロジェクト: huihui7987/blog-1
def star(id):
    post=Post.query.get_or_404(id)
    if current_user.staring(post):
        flash('你已经收藏了这篇文章')
        return redirect(url_for('.post',id=post.id))
    current_user.star(post)
    flash('收藏完成')
    return redirect(url_for('.post',id=post.id))