如何在 AJAX 查询中接收 Django post_save 信号?

How to receive Django post_save signal on AJAX query?

我使用 AJAX 请求创建订单,我还有一个 post_save 信号,应该在订单保存后执行。是否有可能在 AJAX 请求中接收到此 post_save 信号?..因为我没有得到任何东西,信号处理程序被忽略 =|

1. 好的。在我阅读完整的 documentation of signals in depth I didn't find anything that helped me to solve the prolem. Then I have read this post 之后,详细描述了信号。所以,我忘记在模块的 __init__.py 中添加 default_app_config

default_app_config = 'cmdbox.profiles.apps.ProfilesConfig'

希望这个提示能帮助像我这样的人)

2. 主要问题的答案,感谢Daniel Roseman:

If you have a post-save signal, it is always sent on save. It has nothing to do with whether the original request is Ajax or not.