当前位置: 首页>>代码示例>>Python>>正文


Python RegistrationAdmin.resend_activation_email方法代码示例

本文整理汇总了Python中registration.admin.RegistrationAdmin.resend_activation_email方法的典型用法代码示例。如果您正苦于以下问题:Python RegistrationAdmin.resend_activation_email方法的具体用法?Python RegistrationAdmin.resend_activation_email怎么用?Python RegistrationAdmin.resend_activation_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在registration.admin.RegistrationAdmin的用法示例。


在下文中一共展示了RegistrationAdmin.resend_activation_email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_email_send_action_no_sites

# 需要导入模块: from registration.admin import RegistrationAdmin [as 别名]
# 或者: from registration.admin.RegistrationAdmin import resend_activation_email [as 别名]
 def test_email_send_action_no_sites(self):
     """
     Test re-sending of activation emails via admin action when
     ``django.contrib.sites`` is not installed; the fallback will
     be a ``RequestSite`` instance.
     
     """
     Site._meta.installed = False
     admin_class = RegistrationAdmin(RegistrationProfile, admin.site)
     
     alice = self.backend.register(_mock_request(),
                                   username='alice',
                                   first_name='alice',
                                   last_name='wonderland',
                                   email='[email protected]',
                                   password1='swordfish')
     
     admin_class.resend_activation_email(_mock_request(),
                                         RegistrationProfile.objects.all())
     self.assertEqual(len(mail.outbox), 2) # One on registering, one more on the resend.
     
     RegistrationProfile.objects.filter(user=alice).update(activation_key=RegistrationProfile.ACTIVATED)
     admin_class.resend_activation_email(_mock_request(),
                                         RegistrationProfile.objects.all())
     self.assertEqual(len(mail.outbox), 2) # No additional email because the account has activated.
     Site._meta.installed = True
开发者ID:AlfredArouna,项目名称:class2go,代码行数:28,代码来源:backends.py

示例2: test_email_send_action

# 需要导入模块: from registration.admin import RegistrationAdmin [as 别名]
# 或者: from registration.admin.RegistrationAdmin import resend_activation_email [as 别名]
    def test_email_send_action(self):
        """
        Test re-sending of activation emails via admin action.
        
        """
        admin_class = RegistrationAdmin(RegistrationProfile, admin.site)

        alice = self.backend.register(
            _mock_request(), username="alice", email="[email protected]", password1="swordfish"
        )

        admin_class.resend_activation_email(_mock_request(), RegistrationProfile.objects.all())
        self.assertEqual(len(mail.outbox), 2)  # One on registering, one more on the resend.

        RegistrationProfile.objects.filter(user=alice).update(activation_key=RegistrationProfile.ACTIVATED)
        admin_class.resend_activation_email(_mock_request(), RegistrationProfile.objects.all())
        self.assertEqual(len(mail.outbox), 2)  # No additional email because the account has activated.
开发者ID:zhouxin262,项目名称:datapanel,代码行数:19,代码来源:backends.py


注:本文中的registration.admin.RegistrationAdmin.resend_activation_email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。