我目前已将此模型添加到我的应用中
from mainApp.models import modelPatient
class modelBodyParts(models.Model):
part_name = models.CharField(max_length=1000, unique=False , default="")
modelPatient = models.ForeignKey(modelPatient)
result = models.CharField(max_length=3000, unique=False , default="")
现在,makemigrations和migration命令给我以下错误
>>python manage.py makemigrations
>>python ./manage.py migrate
ValueError: The field interviewApp.modelInterviewAnswers.patients was declared with a lazy reference to 'mainApp.modelpatients', but app 'mainApp' doesn't provide model 'modelpatients'
我不确定那是什么意思。但我确实记得,曾经有一个
mainApp.modelpatients
存在,然后将其更改为mainApp.modelpatient
哪一个仍然存在。如何解决此问题,为什么会出现此问题?任何帮助,将不胜感激。
最佳答案
尝试使用RenameModel
和RenameField
。在此处查看答案:https://stackoverflow.com/a/26241640/57952
关于django - 迁移期间的Django问题-懒惰引用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42594382/