本文整理匯總了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)