当用户在 Django 管理中激活时发送电子邮件
我即将创建一个监控注册的网站,只允许某些人注册。毫无疑问,尽管我在注册表上写了任何文字,但仍有一些不适应的人会注册,所以我们会适度进行。
注册后,将创建 django.contrib.auth
User
和个人资料,并向版主发送一封电子邮件。主持人将登录 Django 管理站点,检查他们是否被允许注册并将其帐户标记为活动状态。如果他们是试图溜进去的恶棍,该帐户将被删除。
我将使用 recapcha 来尝试阻止自动尝试。
我想在帐户被激活或删除时发送一封电子邮件,让帐户持有人知道他们的帐户发生了什么事,他们可以登录,或者让他们知道我们知道他们在做什么,他们应该别再犯傻了。
我怀疑这与信号有关,但坦率地说,我不知道这实际上适合哪里,因为我使用的是 django.contrib.auth 提供的预制模型。
任何提示、线索或代码都将被慷慨地接受。
I'm about to create a site that has monitored registration in that only certain people are allowed to register. Undoubtedly some misfits will register despite any writing I put above the registration form so we're going with moderation.
Upon registration a django.contrib.auth
User
and profile will be created and an email will be sent to the moderator. The moderator will log into the Django admin site, check they're somebody who is allowed to register and mark their account active. If they're some miscreant trying to slip in, the account would be deleted.
I'll use recaptcha to try and stop automated attempts.
I would like to fire off an email when an account is activated or deleted to let the account holder know what has happened to their account and that they can either log in, or let them know we know what they're up to and they should stop being silly.
I suspect this has something to do with signals but I frankly don't have a clue where this would actually fit in, given that I'm using a prefab model provided from django.contrib.auth
.
Any tips, clues or code are all graciously accepted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像这样的东西应该有效。 这里是文档。
Something like this should work. Here are the docs.
您想查看信号。
You want to take a look at the Signals.