Мой код, как показано ниже:
class X(models.Model):
class Meta:
db_table = 'X'
ph_no = models.CharField(max_length =255,null=False)
y = models.ForeignKey('y',on_delete=models.CASCADE)
class M(models.Model):
class Meta:
db_table = 'M'
comment = models.CharField(max_length=255,null= False)
x = models.ForeignKey('X',on_delete=models.CASCADE)
class y (models.Model):
class Meta:
db_table = 'y'
details = models.TextField(null= False)
Теперь, когда с этой схемой я запускаю миграции, я получаю следующую ошибку
appName.M.x: (fields.E300) Field defines a relation with model 'X', which is either not installed, or is abstract.
appName.M.x: (fields.E307) The field appName.M.x was declared with a lazy reference to 'appName.X', but app 'appName' doesn't provide model 'X'.
Мой файл settings.pyвыглядит следующим образом:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'rest_framework.authtoken',
'dashboard'
]