本文整理汇总了Python中messages.models.Message.author方法的典型用法代码示例。如果您正苦于以下问题:Python Message.author方法的具体用法?Python Message.author怎么用?Python Message.author使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages.models.Message
的用法示例。
在下文中一共展示了Message.author方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: invite_send_message
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import author [as 别名]
def invite_send_message(sender, instance, created, **kwargs):
if created:
msg = Message()
msg.subject = ugettext(u'Invitation to join a team')
msg.user = instance.user
msg.object = instance
msg.author = instance.author
msg.save()
示例2: save
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import author [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