本文整理汇总了Python中corehq.apps.registration.models.RegistrationRequest.get_requests_24hrs_ago方法的典型用法代码示例。如果您正苦于以下问题:Python RegistrationRequest.get_requests_24hrs_ago方法的具体用法?Python RegistrationRequest.get_requests_24hrs_ago怎么用?Python RegistrationRequest.get_requests_24hrs_ago使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.registration.models.RegistrationRequest
的用法示例。
在下文中一共展示了RegistrationRequest.get_requests_24hrs_ago方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: activation_24hr_reminder_email
# 需要导入模块: from corehq.apps.registration.models import RegistrationRequest [as 别名]
# 或者: from corehq.apps.registration.models.RegistrationRequest import get_requests_24hrs_ago [as 别名]
def activation_24hr_reminder_email():
"""
Reminds inactive users registered 24 hrs ago to activate their account.
"""
request_reminders = RegistrationRequest.get_requests_24hrs_ago()
DNS_name = get_site_domain()
for request in request_reminders:
user = WebUser.get_by_username(request.new_user_username)
registration_link = 'http://' + DNS_name + reverse(
'registration_confirm_domain') + request.activation_guid + '/'
email_context = {
"domain": request.domain,
"registration_link": registration_link,
"full_name": user.full_name,
"first_name": user.first_name,
'url_prefix': '' if settings.STATIC_CDN else 'http://' + DNS_name,
}
message_plaintext = render_to_string(
'registration/email/confirm_account_reminder.txt', email_context)
message_html = render_to_string(
'registration/email/confirm_account.html', email_context)
subject = ugettext('Reminder to Activate your CommCare project')
send_html_email_async.delay(
subject, request.new_user_username, message_html,
text_content=message_plaintext,
email_from=settings.DEFAULT_FROM_EMAIL
)