title: How do I run a function on each post in my list view and pass a boolean variable into my html?
body: <h3>My html</h3>
  
  <pre><code>{% if post.is_liked %}
      &lt;i class="fa fa-check" aria-hidden="true"&gt;&lt;/i&gt;
  {% else %}
      &lt;i class="fa fa-times" aria-hidden="true"&gt;&lt;/i&gt;
  {% endif %}
  </code></pre>
  
  <h3>My views.py</h3>
  
  <pre><code>class PostListView(ListView):
      queryset = Post.objects.filter(created__range=['2020-03-01', '2020-03-31'])
      template_name = 'main/problems.html'
      context_object_name = 'posts'
      ordering = ['-created']
  
      def get_liked(self):
          post = self.get_object()
          user = get_object_or_404(User, username=post.kwargs.get('username'))
          if post.likes.filter(username=user).exists():
              post.annotate(is_liked=True)
          else:
              post.annotate(is_liked=False)
  </code></pre>
  
  <p>Even if I set both conditionals to return true my html does not read <code>is_liked</code> as true.</p>