title: Calling a method on a model from a template
body: <p>I am trying to call a method in a model from a template and I have come to the conclusion that this cannot be done.</p>
  
  <p>This is my code         </p>
  
  <pre><code>{% if request.user.is_authenticated %}
    {% if a_story.is_story_liked(request.user.id) %}
      &lt;a class="story_like" data-id="{{ a_story.id }}" href="#"&gt;Like&lt;/a&gt;
    {% endif %}
    {% else %}
      &lt;a class="story_like_login" data-id="{{ a_story.id }}" href="#"&gt;Like&lt;/a&gt;
  {% endif %}
  </code></pre>
  
  <p>The error happens on the second line. "is_story_liked" checks if the user has "liked" a story or not. If not, then I would write the same anchor tag but with a different class. </p>
  
  <p>I am kinda stumped with this one. I am trying to output different class names: if the user is logged in, if the user is not logged in and if the user has "liked" or not "liked" an article/story.</p>