当前位置: 首页>>代码示例>>Python>>正文


Python Follower.follow方法代码示例

本文整理汇总了Python中skylines.model.Follower.follow方法的典型用法代码示例。如果您正苦于以下问题:Python Follower.follow方法的具体用法?Python Follower.follow怎么用?Python Follower.follow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在skylines.model.Follower的用法示例。


在下文中一共展示了Follower.follow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: follow

# 需要导入模块: from skylines.model import Follower [as 别名]
# 或者: from skylines.model.Follower import follow [as 别名]
def follow(user_id):
    user = get_requested_record(User, user_id)
    current_user = User.get(request.user_id)
    Follower.follow(current_user, user)
    create_follower_notification(user, current_user)
    db.session.commit()
    return jsonify()
开发者ID:skylines-project,项目名称:skylines,代码行数:9,代码来源:users.py

示例2: follow

# 需要导入模块: from skylines.model import Follower [as 别名]
# 或者: from skylines.model.Follower import follow [as 别名]
def follow():
    Follower.follow(g.current_user, g.user)
    create_follower_notification(g.user, g.current_user)
    db.session.flush()

    unlock_user_achievements(g.current_user, FOLLOW_ACHIEVEMENTS)
    unlock_user_achievements(g.user, FOLLOWER_ACHIEVEMENTS)
    db.session.commit()
    return redirect(request.referrer or url_for('.index'))
开发者ID:kedder,项目名称:skylines,代码行数:11,代码来源:user.py

示例3: test_following

# 需要导入模块: from skylines.model import Follower [as 别名]
# 或者: from skylines.model.Follower import follow [as 别名]
def test_following(db_session, client):
    john = users.john()
    jane = users.jane()
    add_fixtures(db_session, john, jane)
    Follower.follow(john, jane)

    res = client.get("/users/{id}".format(id=john.id))
    assert res.status_code == 200
    assert res.json["following"] == 1

    res = client.get("/users/{id}".format(id=jane.id))
    assert res.status_code == 200
    assert res.json["followers"] == 1
    assert "followed" not in res.json

    res = client.get("/users/{id}".format(id=jane.id), headers=auth_for(john))
    assert res.status_code == 200
    assert res.json["followers"] == 1
    assert res.json["followed"] == True
开发者ID:skylines-project,项目名称:skylines,代码行数:21,代码来源:read_test.py

示例4: follow

# 需要导入模块: from skylines.model import Follower [as 别名]
# 或者: from skylines.model.Follower import follow [as 别名]
 def follow(self):
     Follower.follow(request.identity['user'], self.user)
     create_follower_notification(self.user, request.identity['user'])
     redirect('.')
开发者ID:gabor-konrad,项目名称:Skylines,代码行数:6,代码来源:users.py

示例5: follow

# 需要导入模块: from skylines.model import Follower [as 别名]
# 或者: from skylines.model.Follower import follow [as 别名]
def follow():
    Follower.follow(g.current_user, g.user)
    create_follower_notification(g.user, g.current_user)
    db.session.commit()
    return redirect(url_for('.index'))
开发者ID:imclab,项目名称:skylines,代码行数:7,代码来源:user.py

示例6: follow

# 需要导入模块: from skylines.model import Follower [as 别名]
# 或者: from skylines.model.Follower import follow [as 别名]
 def follow(self):
     Follower.follow(request.identity['user'], self.user)
     redirect('.')
开发者ID:Plantain,项目名称:Skylines,代码行数:5,代码来源:users.py


注:本文中的skylines.model.Follower.follow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。