title: How to use Modal Foreign key
body: <p>comment in a situation where my modal looks like this i want to display comments without having to go to different page</p>
  <pre><code>class Posts(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      post_name = models.CharField(max_length=150)
      desription = models.CharField(max_length=200)
      image = models.ImageField(upload_to=&quot;images/uploads&quot;)
      like = models.ManyToManyField(User, related_name=&quot;liked&quot;, blank=True, default=None)
      like_count = models.BigIntegerField(default=0)
      date_added = models.DateField(auto_now_add=True, blank=True)
  
      # @property
      # def like_count(self):
      #     return self.like.count()
  
      def __str__(self):
          return self.desription
  
      class Meta:
          db_table = &quot;Posts&quot;
          ordering = [&quot;date_added&quot;]
  
  
  class Comments(models.Model):
      post = models.ForeignKey(Posts, on_delete=models.CASCADE)
      comment = models.CharField(max_length=500)
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      date_added = models.DateField(auto_now=True, blank=True)
  
      class Meta:
          db_table = &quot;Comments&quot;
          ordering = ['date_added']
  </code></pre>
  <p>and in the index use</p>
  <p>{{post.comment}}  ???</p>