进行迁移未检测模型中的多对多字段
python 191
原文标题 :Make migrations is not detecting many to many field in model
以下是我的模型:
class Message(models.Model):
sender = models.ForeignKey(
to=Profile, on_delete=models.CASCADE, related_name="sender", null=True) # This null is temporary will remove it
receiver = models.ForeignKey(
to=Profile, on_delete=models.CASCADE, related_name="receiver", null=True) # This null is temporary will remove it
text = models.TextField()
timestamp = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.text
class Meta:
ordering = ["timestamp"]
class Chat(models.Model):
conversation: models.ManyToManyField(Message) #---> This field is not being detected.
first_participant = models.ForeignKey(
Profile, on_delete=models.CASCADE, related_name="first_participant")
second_participant = models.ForeignKey(
Profile, on_delete=models.CASCADE, related_name="second_participant")
date_modified = models.DateTimeField(auto_now=True)
无论我做什么,进行迁移都不会检测到这个多对多的字段。有人可以帮忙吗?