'Make migrations is not detecting many to many field in model

Following are my models:

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)

No matter what i do, make migrations is not detecting this many to many field. Can someone please help?



Solution 1:[1]

You put conversation: models.ManyToManyField(Message) instead of conversation=models.ManyToManyField(Message)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RedWheelbarrow