{% extends '_base.html' %}
{% block body %}
    <h1>{{ product.name }}</h1>
    <img src="{{ product.image.url }}" width="200" alt="{{ product.name }}">
    <p>تعداد موجودی : {{ product.amount }}</p>
    <p>{{ product.information }}</p>
    <hr>
    <span>like : {{ product.total_like }}</span>

    {% if is_like %}
    	<a href="{% url 'home:product_like' 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_unlike' 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 %}

{% endblock %}


i wanna do when i click like unlike disables and reverse

here is views :
from django.shortcuts import render, redirect
from .models import *
# Create your views here.

def home(request):
    category = Category.objects.filter(sub_cat = False)
    return render(request , 'home/home.html' , {'category':category})

def all_products(request ,slug= None , id=None):
    products = Product.objects.all()
    category = Category.objects.filter(sub_cat = False)
    if slug and id:
        data = Category.objects.get(slug = slug , id=id)
        products = products.filter(category = data)
    return render(request , 'home/products.html' ,
                  {'products':products ,'category':category})


def product_details(request , id) :
    product = Product.objects.get(id = id)
    similar = product.tags.similar_objects()[:5]
    is_like = False
    is_unlike = False
    if product.unlike.filter(id=request.user.id).exists():
        is_unlike = True
    if product.like.filter(id=request.user.id).exists():
        is_like = True
    if product.status != 'None' :
        if request.method == 'POST' :
            variant = Variants.objects.filter(product_variant_id=id)
            var_id = request.POST.get('select')
            variants = Variants.objects.get(id = var_id)
        else :
            variant = Variants.objects.filter(product_variant_id=id)
            variants = Variants.objects.get(id=variant[0].id)
        return render(request , 'home/details.html' ,
                      {'product':product , 'variant':variant ,'variants':variants,'similar':similar , 'is_like':is_like , 'is_unlike':is_unlike})
    else :
        return render(request, 'home/details.html',
                      {'product': product , 'similar':similar ,'is_like':is_like , 'is_unlike':is_unlike})

def product_like(request , id) :
    url = request.META.get('HTTP_REFERER')
    product = Product.objects.get(id = id)
    if product.like.filter(id=request.user.id).exists() :
        product.like.remove(request.user)
    else:
        product.like.add(request.user)
    return redirect(url)
def product_unlike(request , id) :
    url = request.META.get('HTTP_REFERER')
    product = Product.objects.get(id = id)
    if product.unlike.filter(id=request.user.id).exists() :
        product.unlike.remove(request.user)
    else:
        product.unlike.add(request.user)
    return redirect(url)