2
由于我们的应用有很多模型,我们将它们放在模型包的子包中,即Cheddar
模型不会在models.Cheddar
中,而是在models.cheese.Cheddar
。Django South:我如何访问迁移中的子包中的模型
看来我无法在南数据迁移中访问这些模型,即使我创建了models/__init__.py
根据this answer包含行from cheese import *
。
在我的数据迁移文件,该行for cheddar in orm.Cheddar.objects.all():
还是引起以下错误:
AttributeError: The model 'Cheddar' from the app 'core' is not available in this migration. (Did you use orm.ModelName, not orm['app.ModelName']?)
尝试使用orm['core.models.cheese.Cheddar']
反而使这个错误:
KeyError: "The model 'cheddar' from the app 'core' is not available in this migration."
有谁知道如何解决这个问题?