本文整理汇总了Python中rogerthat.models.UserProfile.list_by_birth_day方法的典型用法代码示例。如果您正苦于以下问题:Python UserProfile.list_by_birth_day方法的具体用法?Python UserProfile.list_by_birth_day怎么用?Python UserProfile.list_by_birth_day使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rogerthat.models.UserProfile
的用法示例。
在下文中一共展示了UserProfile.list_by_birth_day方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_birthday_messages
# 需要导入模块: from rogerthat.models import UserProfile [as 别名]
# 或者: from rogerthat.models.UserProfile import list_by_birth_day [as 别名]
def send_birthday_messages():
messages_per_app = get_all_app_birthday_messages()
receivers_per_app = defaultdict(list)
for user_profile in UserProfile.list_by_birth_day(now()):
assert (isinstance(user_profile, UserProfile))
if user_profile.app_id not in messages_per_app: # this will be faster than doing multiple queries on app ids
continue
receivers_per_app[user_profile.app_id].append(UserMemberTO(user_profile.user, Message.ALERT_FLAG_VIBRATE))
for app_id, receivers in receivers_per_app.iteritems():
message, branding_hash = messages_per_app[app_id]
deferred.defer(sendMessage, MC_DASHBOARD, receivers, Message.FLAG_ALLOW_DISMISS, 0, None, message, [], None,
branding_hash, None, is_mfr=False)