本文整理汇总了Python中registration.admin.RegistrationAdmin.activate_users方法的典型用法代码示例。如果您正苦于以下问题:Python RegistrationAdmin.activate_users方法的具体用法?Python RegistrationAdmin.activate_users怎么用?Python RegistrationAdmin.activate_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类registration.admin.RegistrationAdmin
的用法示例。
在下文中一共展示了RegistrationAdmin.activate_users方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_activation_action
# 需要导入模块: from registration.admin import RegistrationAdmin [as 别名]
# 或者: from registration.admin.RegistrationAdmin import activate_users [as 别名]
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)
示例2: test_activation_action
# 需要导入模块: from registration.admin import RegistrationAdmin [as 别名]
# 或者: from registration.admin.RegistrationAdmin import activate_users [as 别名]
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)