0

样品模型

from simple_history.models import HistoricalRecords()

class Sample(models.Model):
  company = models.CharField(max_length=100,null=True,blank=True)  
  history = HistoricalRecords()

在上面的模型中,我使用了HistoricalRecordsfrom django-simple-history来保存每个实例的更改历史Sample

问题

history_user无法填充错误消息:**Error** : 1452, 'Cannot add or update a child row: a foreign key constraint fails,REFERENCES auth_user (id)

如何在实例中设置history_change_reasonand ?history_user_idHistoricalRecords()

编辑:尝试过这个解决方案:链接

4

0 回答 0