title: Django: check if user liked post and corresponding comments in template
body: <p>In user profile page I am displaying posts and comments of the persons that the user is following. I want to check and display like symbol for the posts and comments liked by user. What is the best way to test if user liked post and comment in the template?</p>
  
  <p>Post model:</p>
  
  <pre><code>class Post(models.Model):
      author = models.ForeignKey(CustomUser,on_delete=models.CASCADE,)
      title = models.CharField(max_length=200,null=True)
      text = models.TextField()
      created_date = models.DateTimeField(default=timezone.now)
      published_date = models.DateTimeField(blank=True, null=True)
      slug = models.SlugField(unique=True, blank=True)
      nLikes = models.IntegerField(default= 0)
  </code></pre>
  
  <p>Comment model:</p>
  
  <pre><code>class Comment(models.Model):
  post = models.ForeignKey('Post', related_name='comments',on_delete=models.CASCADE,)
  author = models.ForeignKey(CustomUser,on_delete=models.CASCADE,)
  text = models.TextField()
  created_date = models.DateTimeField(default=timezone.now)
  slug = models.SlugField(unique=True, default=uuid.uuid4)
  nLikes = models.IntegerField(default= 0)
  </code></pre>
  
  <p>Post like model:</p>
  
  <pre><code>class PostLike(models.Model):
  post = models.ForeignKey('Post', related_name='related_post',on_delete=models.CASCADE,)
  user = models.ForeignKey(CustomUser,on_delete=models.CASCADE,)
  liked_date = models.DateTimeField(default=timezone.now)
  </code></pre>
  
  <p>comment like model:</p>
  
  <pre><code>class CommentLike(models.Model):
      comment = models.ForeignKey('Comment', related_name='related_comment',on_delete=models.CASCADE,)
      user = models.ForeignKey(CustomUser,on_delete=models.CASCADE,)
      liked_date = models.DateTimeField(default=timezone.now)
  </code></pre>
  
  <p>my template will be similar to this. I am adding simplified version here just to make things easy</p>
  
  <pre><code>{% for post in post_queryset %}
     &lt;div&gt;
       {{ post.text }}
     &lt;/div&gt;
     {% for comment in post.comments.all %}
     &lt;/div&gt;
       {{ comment.text }}
     &lt;/div&gt;
     {% endfor %}
  {% endfor %}
  </code></pre>
  
  <p>What is the best way to check if the post and comment liked by the user? I am thinking of using template tags, is there any better way?</p>