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


Python User.make_deleted方法代码示例

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


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

示例1:

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import make_deleted [as 别名]
    db.session.add(u3u4)
    db.session.add(u3u5)
    db.session.add(u3u6)
    db.session.add(u4u1)
    db.session.add(u4u3)
    db.session.add(u4u4)
    db.session.add(u5u1)
    db.session.add(u5u2)
    db.session.add(u5u5)
    db.session.add(u5u6)
    db.session.add(u6u1)
    db.session.add(u6u4)
    db.session.add(u6u6)
    db.session.commit()

    u5.make_deleted()
    db.session.add(u5)

    t1.make_deleted()
    db.session.add(t1)

    t5u4.make_deleted()
    t5u6.make_deleted()
    db.session.add(t5u4)
    db.session.add(t5u6)

    u6u1.make_deleted()
    db.session.add(u6u1)
    db.session.commit()

    # # delete thank to user
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:33,代码来源:db_init.py

示例2: test

# 需要导入模块: from app.user.models import User [as 别名]
# 或者: from app.user.models.User import make_deleted [as 别名]

#.........这里部分代码省略.........
        t1u1 = ThankReceivedByUser(t1.id, u1.id)
        t1u2 = ThankReceivedByUser(t1.id, u2.id)
        t1u3 = ThankReceivedByUser(t1.id, u3.id)
        t1u4 = ThankReceivedByUser(t1.id, u4.id)

        t2u1 = ThankReceivedByUser(t2.id, u1.id)
        t2u2 = ThankReceivedByUser(t2.id, u2.id)
        t2u3 = ThankReceivedByUser(t2.id, u3.id)

        t3u1 = ThankReceivedByUser(t3.id, u1.id)
        t3u2 = ThankReceivedByUser(t3.id, u2.id)

        t4u1 = ThankReceivedByUser(t4.id, u1.id)

        db.session.add(t1u1)
        db.session.add(t1u2)
        db.session.add(t1u3)
        db.session.add(t1u4)
        db.session.add(t2u1)
        db.session.add(t2u2)
        db.session.add(t2u3)
        db.session.add(t3u1)
        db.session.add(t3u2)
        db.session.add(t4u1)
        db.session.commit()

        assert len(u1.thanks_received.all()) == 4
        assert len(u2.thanks_received.all()) == 3
        assert len(u3.thanks_received.all()) == 2
        assert len(u4.thanks_received.all()) == 1

        # delete thank

        t1.make_deleted()
        db.session.add(t1)
        db.session.commit()

        assert len(u1.thanks_received.all()) == 3
        assert len(u2.thanks_received.all()) == 2
        assert len(u3.thanks_received.all()) == 1
        assert len(u4.thanks_received.all()) == 0

        # delete thank to user

        t2u1.make_deleted()
        db.session.add(t2u1)
        db.session.commit()

        assert len(u1.thanks_received.all()) == 2
        assert len(u2.thanks_received.all()) == 2
        assert len(u3.thanks_received.all()) == 1
        assert len(u4.thanks_received.all()) == 0

        # follow users

        u1u1 = Follow(u1.id, u1.id)
        u1u2 = Follow(u1.id, u2.id)
        u1u3 = Follow(u1.id, u3.id)
        u1u4 = Follow(u1.id, u4.id)

        u2u1 = Follow(u2.id, u1.id)
        u2u2 = Follow(u2.id, u2.id)
        u2u3 = Follow(u2.id, u3.id)

        u3u1 = Follow(u3.id, u1.id)
        u3u2 = Follow(u3.id, u2.id)
开发者ID:dogukantufekci,项目名称:thankspress,代码行数:70,代码来源:test.py


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