を解決することはできません。どちらもINSTALLED_APPS
にあり、最初にook
です。 ook.models.py
でとValueError:関連モデルu'app.modelは、」私は二つのアプリケーション(<code>ook</code>と<code>eek</code>が言う)を持っていると私は<code>eek</code>でモデルから<code>ook</code>でモデルへの外部キーを使用したい
、私が持っている:eek.models.py
で
class Fubar(models.Model):
...
を、私が持っている:
class monkey(models.Model):
external = models.ForeignKey('ook.Fubar', blank=True, null=True)
...
移行が生成されます。
class Migration(migrations.Migration):
dependencies = [
('eek', '0002_auto_20151029_1040'),
]
operations = [
migrations.AlterField(
model_name='monkey',
name='external',
field=models.ForeignKey(blank=True, to='ook.Fubar', null=True),
),
]
私は、マイグレーションを実行すると、私が手このエラー:
...
1595 raise ValueError('Foreign Object from and to fields must be
the same non-zero length')
1596 if isinstance(self.rel.to, six.string_types):
-> 1597 raise ValueError('Related model %r cannot be resolved' % self.rel.to)
1598 related_fields = []
1599 for index in range(len(self.from_fields)):
ValueError: Related model u'ook.Fubar' cannot be resolved
私は間違っていますか?
'ook'と' eek'はsettings.py' 'でINSTALLED_APPS''に含まれていますか? – Leistungsabfall
@ Leistungsabfall:はい、彼らは 'ook'が' eek'の前です。 – Sardathrion
'ook.models.Foobar' maybe? – cdvv7788