本文整理汇总了Python中messages.models.Message.content方法的典型用法代码示例。如果您正苦于以下问题:Python Message.content方法的具体用法?Python Message.content怎么用?Python Message.content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages.models.Message
的用法示例。
在下文中一共展示了Message.content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_to_teams
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import content [as 别名]
def send_to_teams(self, team_ids, author):
subject = self.cleaned_data['subject']
content = self.cleaned_data['content']
content = u''.join([content, '\n\n', ugettext('This message is from site administrator.')])
users = User.objects.filter(teams__in=team_ids).exclude(pk=author.pk)
for user in users:
m = Message(author=author, user=user)
m.subject = subject
m.content = content
m.save()
return users.count()
示例2: save
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import content [as 别名]
def save(self):
messages = []
team = self.cleaned_data['team']
languages = self.cleaned_data['languages']
members = team.users.exclude(pk=self.author.pk)
if languages:
members = members.filter(userlanguage__language__in=languages).distinct()
for user in members:
message = Message(user=user)
message.author = self.author
message.content = self.cleaned_data['content']
message.subject = self.cleaned_data['subject']
message.object = team
message.save()
messages.append(message)
return messages