我正在覆盖我的 Django 模型 save() 方法,因此我可以对对象进行一些额外的健全性检查。 (save() 是执行此操作的正确位置吗?)
我的 fixtures/initial_fixtures.yaml 对象似乎没有调用它们的 save() 方法。我怎样才能健全地检查我的固定装置?
最佳答案
从 Django 1.5 开始,不调用 save():
When fixture files are processed, the data is saved to the database as is. Model defined save() methods are not called, and any pre_save or post_save signals will be called with raw=True since the instance only contains attributes that are local to the model.
关于django - model.save() 在加载 Django fixtures 时没有被调用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7879948/