title: How to call function within if statement in Django template
body: <p>I have a custom template tag as following:</p>
  
  <pre><code>@register.simple_tag
  def call_method(obj, method_name, *args):
      """
      Usage
      in shell
      obj.votes.exists(user_id)
  
      in template
      {% call_method obj.votes 'exists' user.id %}
      """
      method = getattr(obj, method_name)
      return method(*args)
  </code></pre>
  
  <p>Then I can call it in the template (Class-based detail view) as following.</p>
  
  <pre><code>{% call_method object.votes 'exists' user.id %}
  </code></pre>
  
  <p>My question is how can use this template tag in If statement?
  For example, why I cannot use like:</p>
  
  <pre><code>{% if call_method object.votes 'exists' user.id %}
  </code></pre>
  
  <p>I am using django-vote [<a href="https://github.com/shanbay/django-vote][1]" rel="nofollow noreferrer">https://github.com/shanbay/django-vote][1]</a></p>
  
  <p>My goal is to check whether a user already voted so that I can change the class of the vote button.
  Otherwise, I can already check it in view. And it works fine.</p>
  
  <p>If it is not possible to use the simple tag with argument within If statement, could you please suggest a way to reach my goal?</p>
  
  <p>Edit:
  I am adding view.</p>
  
  <pre><code>def vote(request, slug):
      term = Term.objects.get(slug=slug)
  
      if term.votes.exists(user_id=request.user.id):
          term.votes.down(user_id=request.user.id)
      else:
          term.votes.up(user_id=request.user.id)
  
      return HttpResponseRedirect(term.get_absolute_url())
  </code></pre>
  
  <p>and Model:</p>
  
  <pre><code>class Term(VoteModel, models.Model):
  </code></pre>