本文整理汇总了Python中registration.users.UserModel.set_password方法的典型用法代码示例。如果您正苦于以下问题:Python UserModel.set_password方法的具体用法?Python UserModel.set_password怎么用?Python UserModel.set_password使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类registration.users.UserModel
的用法示例。
在下文中一共展示了UserModel.set_password方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_inactive_user
# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import set_password [as 别名]
def create_inactive_user(self, site, new_user=None, send_email=True, request=None, **user_info):
"""
Create a new, inactive ``User``, generate a
``RegistrationProfile`` and email its activation key to the
``User``, returning the new ``User``.
By default, an activation email will be sent to the new
user. To disable this, pass ``send_email=False``.
Additionally, if email is sent and ``request`` is supplied,
it will be passed to the email template.
"""
if new_user == None:
password = user_info.pop('password')
new_user = UserModel()(**user_info)
new_user.set_password( password )
new_user.is_active = True
new_user.save()
#user_for_choice = Student(student_text = new_user.username)
#user_for_choice.save()
registration_profile = self.create_profile(new_user)
if send_email:
registration_profile.send_activation_email(site, request)
return new_user