本文整理汇总了Python中publicweb.models.Decision.author方法的典型用法代码示例。如果您正苦于以下问题:Python Decision.author方法的具体用法?Python Decision.author怎么用?Python Decision.author使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类publicweb.models.Decision
的用法示例。
在下文中一共展示了Decision.author方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_and_return_decision
# 需要导入模块: from publicweb.models import Decision [as 别名]
# 或者: from publicweb.models.Decision import author [as 别名]
def create_and_return_decision(self, description='Decision Time',
status=Decision.PROPOSAL_STATUS, deadline=now().date()):
decision = Decision(description=description, status=status, organization=self.bettysorg, deadline=deadline)
decision.author = self.user
decision.save()
return decision
示例2: create_and_return_decision
# 需要导入模块: from publicweb.models import Decision [as 别名]
# 或者: from publicweb.models.Decision import author [as 别名]
def create_and_return_decision(self, description='Decision Time',
status=Decision.PROPOSAL_STATUS):
decision = Decision(description=description, status=status)
decision.author = self.user
decision.save()
return decision
示例3: test_emails_dont_contain_escaped_characters
# 需要导入模块: from publicweb.models import Decision [as 别名]
# 或者: from publicweb.models.Decision import author [as 别名]
def test_emails_dont_contain_escaped_characters(self):
"""
We want to verify that the emails sent out do not contain
confusing text like '&' instead of '&' or ''<'
instead of '<'
All plaintext emails should be marked 'safe' in the Django template.
"""
decision = Decision(description='&', status=0)
decision.author = self.user
decision.save()
mymail = OpenConsentEmailMessage('new', decision)
self.assertNotIn('&', mymail.subject)
self.assertNotIn('&', mymail.body)
mymail = OpenConsentEmailMessage('status_change', decision, old_obj=decision)
self.assertNotIn('&', mymail.subject)
self.assertNotIn('&', mymail.body)
mymail = OpenConsentEmailMessage('content_change', decision)
self.assertNotIn('&', mymail.subject)
self.assertNotIn('&', mymail.body)
示例4: test_save_when_no_author
# 需要导入模块: from publicweb.models import Decision [as 别名]
# 或者: from publicweb.models.Decision import author [as 别名]
def test_save_when_no_author(self):
decision = Decision(description="Test", status=0)
decision.author = None
decision.save()
decision = Decision.objects.get()
decision.description = "A change."
try:
decision.save()
except:
self.fail("Failed to save object.")
示例5: test_emails_arent_sent_to_author
# 需要导入模块: from publicweb.models import Decision [as 别名]
# 或者: from publicweb.models.Decision import author [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.author = andy
decision.save()
#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)