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


Python UserModel.set_password方法代码示例

本文整理汇总了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
开发者ID:York-Lee,项目名称:recommendation-letter,代码行数:30,代码来源:models.py


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