title: if and else - both are executing
body: <p>I am building a simple question answer site, in which - I am trying to implement a like button But When i like the post then <code>solid liked button</code> is showing and <code>blank liked button</code> is also showing.</p>
  <p>models.py</p>
  <pre><code>class Question(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      title= models.CharField(max_length=300)
  
  class Answer(models.Model):
      user_by = models.ForeignKey(User, on_delete=models.CASCADE)
      que = models.ForeignKey(Question, on_delete=models.CASCADE)
      body = models.CharField(max_length=300)
  
  class LikeAnswer(models.Model):
      user = models.ForeignKey(User, on_delete=models.CASCADE)
      ans = models.ForeignKey(Answer, on_delete=models.CASCADE)
  </code></pre>
  <p>views.py</p>
  <pre><code>def question_detail(request, question_id):
      obj = get_object_or_404(Question, pk=question_id)
  
      answers = obj.answer_set.all()
  
      context = {'obj':obj,'answers':answers}
      return render(request, 'question_detail.html', context)
  </code></pre>
  <p>quesion_detail.html</p>
  <pre><code>{{obj.title}}
  
  
      {% for anss in answers %}
  
          {% for lks in anss.likeanswer_set.all %}
  
              {% if request.user == lks.user %}
  
                &lt;button name='submit' type='submit' id=&quot;unlike&quot; value=&quot;unlike&quot;&gt;Unlike
      &lt;/button&gt; &lt;i class=&quot;fas fa-thumbs-up&quot;&gt;&lt;/i&gt;
  
              {% else %}
  
                &lt;button name='submit' type='submit' id=&quot;like&quot; value=&quot;like&quot;&gt;
      &lt;/button&gt;&lt;i class=&quot;fal fa-thumbs-up&quot;&gt;&lt;/i&gt;
  
              {% endif %}
  
          {% endfor %}
  
  
      {% endfor %}
  </code></pre>
  <p><strong>What i am trying to do :-</strong></p>
  <p>I am trying to show only filled like button after user like, But it is showing both buttons.</p>
  <ul>
  <li>I have also tried <code>{% empty %}</code> but it didn't made impact on it, It showed same results.</li>
  </ul>
  <p><strong>They are showing like :-</strong></p>
  <p><a href="https://i.stack.imgur.com/gQact.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gQact.png" alt="Image" /></a></p>
  <p>Any help would be much Appreciated. Thank You in Advance.</p>