在 Django 中,信号可以用作回调函数吗?换句话说,信号的“发送者”是否可以通过 send()
的返回值使用它从另一个应用程序收集数据?
最佳答案
Both
send()
andsend_robust()
return a list of tuple pairs[(receiver, response), ... ]
, representing the list of called receiver functions and their response values.
请注意,虽然这是一个相当非正统的机制;如果需要函数的返回值,直接调用即可。
关于Django:信号接收器可以返回数据吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11596799/