@bp.route('/<int:uid>/like', methods=('POST',))
@require_user
def like(uid):
    like = LikeTopic.query.filter_by(
        account_id=g.user.id, topic_id=uid
    ).first()
    if like:
        db.session.delete(like)
        db.session.commit()
        return jsonify(status='ok', action='cancel')
    like = LikeTopic(account_id=g.user.id, topic_id=uid)
    db.session.add(like)
    db.session.commit()
    return jsonify(status='ok', action='like')
Like a topic.
dataset/ETHPy150Open pythoncn/june/june/handlers/topic.py/like