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


Python Decision.watchers方法代码示例

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


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

示例1: test_emails_arent_sent_to_author

# 需要导入模块: from publicweb.models import Decision [as 别名]
# 或者: from publicweb.models.Decision import watchers [as 别名]
    def test_emails_arent_sent_to_author(self):
        """
        We want to make sure that when a user creates or changes an 
        item they are not sent an email. The email goes to those
        that do not already know the item has changed!
        """
        andy = User.objects.create_user("Andy", "[email protected]", password='password')
        billy = User.objects.create_user("Billy", "[email protected]", password='password')
        chris = User.objects.create_user("Chris", "[email protected]", password='password')
        
        decision = Decision(description='Test', status=0)
        decision.save(andy)
        
        #billy decides he wants to watch...
        decision.watchers = [billy]

        #andy changes the content
        mymail = OpenConsentEmailMessage('content_change', decision)
        
        #only watchers get mail, not the author
        self.assertNotIn(andy.email, mymail.to)
        self.assertIn(billy.email, mymail.to)         
        self.assertNotIn(chris.email, mymail.to)
开发者ID:indigo79,项目名称:openconsent,代码行数:25,代码来源:email_test.py


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