我的模特:
class TestSkill(models.Model):
name = models.CharField(max_length=255)
value = models.CharField(max_length=255)
class Girl(models.Model):
skills = models.ManyToManyField(TestSkill)
这创建了以下sql语句:
CREATE TABLE "my_app_girl_skills" ("id" integer NOT NULL PRIMARY KEY AUTOINCREMENT, "girl_id" integer NOT NULL REFERENCES "my_app_girl" ("id"), "testskill_id" integer NOT NULL REFERENCES "my_app_testskill" ("id"))
在我尝试使用sql lite浏览器手动在db中创建一行后,我遇到了错误:
Foreign constraint failed