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))
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))
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))
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))
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))
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))
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))