models.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:dappr 作者: millanp 项目源码 文件源码
def send_user_confirmation(self, request):
        """
        Called after user completes initial registration form.
        Generate a confirmation key, then
        send an email to the associated user with a link (containing the key) 
        to a form allowing them to set their password and confirm their identity.
        """

        # Generate and set a random confirmation key
        self.confirmation_key = get_random_string(length=20, allowed_chars='0123456789')
        self.save()

        # Use appropriate email templates to generate and send the email
        context = {
            "site": get_current_site(request),
            "conf_key": self.confirmation_key,
        }
        self.user.email_user(
            render_to_string("registration/confirmation_email_subject.txt", context=context),
            render_to_string("registration/confirmation_email.html", context=context),
            html_message=render_to_string("registration/confirmation_email.html", context=context),
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号