i want my code that when i click like my unlike option disables and reverse : my html :…
- User
i want my code that when i click like my unlike option disables and reverse :
my html :
{% extends '_base.html' %} {% block body %} {{ product.name }} تعداد موجودی : {{ product.amount }} {{ product.information }} like : {{ product.total_like }}
code{% if is_like %} <a href="{% url 'home:product_unlike' product.id %}"> <i class="bi bi-hand-thumbs-up-fill fs-2" style="color: red"></i> </a> {% else %} <a href="{% url 'home:product_like' product.id %}"> <i class="bi bi-hand-thumbs-up fs-2" style="color: red"></i> </a> {% endif %} {% if is_unlike %} <a href="{% url 'home:product_like' product.id %}"> <i class="bi bi-hand-thumbs-down-fill fs-2" style="color: red"></i> </a> {% else %} <a href="{% url 'home:product_unlike' product.id %}"> <i class="bi bi-hand-thumbs-down fs-2" style="color: red"></i> </a> {% endif %} <span>unlike : {{ product.total_unlike }}</span> {% if product.status == 'Size' %} <form action="" method="post"> {% csrf_token %} {% for data in variant %} <input type="radio" value="{{ data.id }}" {% if variants.id == data.id %} checked {% endif %} name='select' onchange="this.form.submit()" > <a href="" style="text-decoration: none">{{ data.size_variant }}</a> {% endfor %} </form> {% elif product.status == 'Color' %} <form action="" method="post"> {% csrf_token %} {% for data in variant %} <input type="radio" value="{{ data.id }}" {% if variants.id == data.id %} checked {% endif %} name='select' onchange="this.form.submit()" > <a href="" style="text-decoration: none">{{ data.color_variant }}</a> {% endfor %} </form> {% endif %} <hr> <p>similar products</p> {% for tags in similar %} <a href="{% url 'home:details' tags.id %}"><img src="{{ tags.image.url }}" width="200" alt="{{ tags.name }}"></a> {% endfor %} - Assistant