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


Python admin.RegistrationAdmin类代码示例

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


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

示例1: test_force_activate_users_action

    def test_force_activate_users_action(self):
        admin_class = RegistrationAdmin(RegistrationProfile, admin.site)

        self.backend.register(username='bob', email='[email protected]', request=self.mock_request)
        admin_class.force_activate_users(None, RegistrationProfile.objects.all())

        self.assertEqual(RegistrationProfile.objects.count(), 0)
开发者ID:SaeX,项目名称:django-inspectional-registration,代码行数:7,代码来源:test_admin.py

示例2: test_email_send_action_no_sites

 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,代码行数:26,代码来源:backends.py

示例3: test_resend_acceptance_email_action

    def test_resend_acceptance_email_action(self):
        admin_class = RegistrationAdmin(RegistrationProfile, admin.site)

        self.backend.register(username='bob', email='[email protected]', request=self.mock_request)
        admin_class.resend_acceptance_email(None, RegistrationProfile.objects.all())

        # one for registration, one for resend
        self.assertEqual(len(mail.outbox), 2)
开发者ID:SaeX,项目名称:django-inspectional-registration,代码行数:8,代码来源:test_admin.py

示例4: test_get_inline_instances_with_default_supplements

    def test_get_inline_instances_with_default_supplements(self):
        admin_class = RegistrationAdmin(RegistrationProfile, admin.site)
        # Prevent caching
        if hasattr(admin_class.backend, '_supplement_class_cache'):
            delattr(admin_class.backend, '_supplement_class_cache')

        inline_instances = admin_class.get_inline_instances(self.mock_request, None)
        self.assertEqual(len(inline_instances), 1)
开发者ID:lambdalisue,项目名称:django-inspectional-registration,代码行数:8,代码来源:test_admin.py

示例5: test_reject_users_action

    def test_reject_users_action(self):
        admin_class = RegistrationAdmin(RegistrationProfile, admin.site)

        self.backend.register(username='bob', email='[email protected]', request=self.mock_request)
        admin_class.reject_users(None, RegistrationProfile.objects.all())

        for profile in RegistrationProfile.objects.all():
            self.assertEqual(profile.status, 'rejected')
            self.assertEqual(profile.activation_key, None)
开发者ID:SaeX,项目名称:django-inspectional-registration,代码行数:9,代码来源:test_admin.py

示例6: test_activation_action

    def test_activation_action(self):
        """
        Test manual activation of users view admin action.
        
        """
        admin_class = RegistrationAdmin(RegistrationProfile, admin.site)

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

        admin_class.activate_users(_mock_request(), RegistrationProfile.objects.all())
        self.failUnless(User.objects.get(username="alice").is_active)
开发者ID:zhouxin262,项目名称:datapanel,代码行数:13,代码来源:backends.py

示例7: test_activation_action

    def test_activation_action(self):
        """
        Test manual activation of users view admin action.
        
        """
        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.activate_users(_mock_request(),
                                   RegistrationProfile.objects.all())
        self.failUnless(User.objects.get(username='alice').is_active)
开发者ID:AlfredArouna,项目名称:class2go,代码行数:17,代码来源:backends.py

示例8: test_email_send_action

    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,代码行数:17,代码来源:backends.py


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