连接Django注册信号 [英] Connecting a django-registration signal

查看:104
本文介绍了连接Django注册信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个函数:

def create(sender, **kw):
  [...]

当调用django注册的user_activated信号时应调用哪个。

Which should be called when the user_activated signal from django-registration is called.

我使用以下命令连接信号和功能:

I connect the signal and the function using this:

from registration.signals import user_activated
[...]
post_save.connect(create, sender=user_activated, dispatch_uid="users-atactivation-signal")

但是当用户单击通过电子邮件获得的激活链接时,不会调用该函数。

But the function isn't called when a user clicks on the activation link, which he got by email.

什么我想念这里吗?

推荐答案

像这样的函数:

def create(sender, user, request, **kwarg):
[...]

和如下所示的连接调用:

and a connect call like this:

user_activated.connect(create)

做这份工作。我的Signals.py文件中有这些文件。

does the job. I have these in my signals.py file.

这篇关于连接Django注册信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆