我想监听由simple-history包提供的pre_create_historical_record信号,但只监听来自某些发送者的信号。问题是,历史模型是由简单历史生成的,我不知道如何将类"core.HistoricalUser“作为类型导入,以便设置为发送者。
发布于 2020-05-04 22:35:27
您可以通过历史记录管理器来访问模型类,如文档here所示。
在您的特定情况下,如下所示-假设您的历史记录管理器名为history,您要跟踪其历史记录的模型是User
pre_create_historical_record.connect(
signal_receiver_function,
sender=User.history.model
)https://stackoverflow.com/questions/61594551
复制相似问题