models.py 文件源码

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

项目:opencon-2016-app-code 作者: sparcopen 项目源码 文件源码
def send_access(self):
        if self.sent_email_data:
            can_send = timezone.now() - self.sent_email_data > datetime.timedelta(minutes=settings.SEND_ACCESS_INTERVAL)
        else:
            can_send = True

        if can_send:
            self.sent_email_data = timezone.now()
            self.save()
            if settings.SEND_EMAILS:
                message = render_to_string('application/email/draft.txt', {'uuid': self.uuid, 'email': self.email,})
                email = EmailMessage(
                    subject='OpenCon 2016 Draft Application',
                    body=message,
                    from_email=settings.DEFAULT_FROM_EMAIL,
                    to=[self.email],
                )
                email.content_subtype = "html"
                email.send(fail_silently=True)
            return True
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号