def delete(self, name):
topic = None
if not current_user.is_authenticated:
return abort(401, message='permission denied')
for topic in current_user.following_topics:
if topic.name == name:
break
else:
return abort(400, message='topic not found')
try:
current_user.following_topics.remove(topic)
if topic.followers_count > 0:
topic.followers_count -= 1
db.session.commit()
except:
db.session.rollback()
return abort(500, message='operation failed')
评论列表
文章目录