Не удается правильно расширить таблицу подкатегорий категорий

Я делаю сайт покупок и динамически отображаю данные с помощью сериализаторов и внешних ключей, и я пытаюсь расширить таблицу подкатегорий категорий на другую страницу. Ниже приведено изображение таблицы. Ниже представлен файл 'shoppingpage.html' enter image description here

Проблема в том, что только "Наши продукты" расширяются, но остальная часть таблицы не расширяется, как показано ниже enter image description here

Ниже представлен html-код для shoppingpage.html

     <ul>
        
        <a class="lynessa-menu-item-title" title="Our Products" href="/allproducts">Our
            Products</a>
        <div class="submenu megamenu megamenu-shop">
            <div class="row">
                {% for result in category %}
                <div class="col-md-3">
                    <div class="lynessa-listitem style-01">
                        <div class="listitem-inner">
                            <a href="{% url 'polls:category' result.id  %}" target="_self">
                                <h4 class="title">{{result.category_name}}</h4>
                            </a>
                            {% for ans in result.subcategories_set.all %}
                            <ul class="listitem-list">
                                <li>
                                    <a href="{% url 'polls:subcategory' ans.id %}" target="_self">{{ans.sub_categories_name}}</a>
                                </li>
                            </ul>
                            {% endfor %}
                        </div>
                    </div>
                </div>
                {% endfor %}
            </div>
        </div>
    </ul>
    {% block content %}

    {% endblock %}

category.html

{% extends 'polls/shoppingpage.html' %}
    <h1>Hello,to categorybase world!</h1>
    {% block content %}
    <ul class="row products columns-3" id="appendproducts">
        {% for product in products %}
            <li class="product-item wow fadeInUp product-item rows-space-30 col-bg-4 col-xl-4 col-lg-6 col-md-6 col-sm-6 col-ts-6 style-01 post-24 product type-product status-publish has-post-thumbnail product_cat-chair product_cat-table product_cat-new-arrivals product_tag-light product_tag-hat product_tag-sock first instock featured shipping-taxable purchasable product-type-variable has-default-attributes" data-wow-duration="1s" data-wow-delay="0ms" data-wow="fadeInUp">
                <div class="product-inner tooltip-left">
                    <div class="product-thumb">
                        <a href="{% url 'polls:productdetails' product.id %}" class="thumb-link">
                            <img class="img-responsive" src="{{product.image.url}}" alt="Product Image" width="400" height="400">
                        </a>
                    </div>
                    <div class="product-info equal-elem">
                        <h3 class="product-name product_title">
                            <a href="{% url 'polls:productdetails' product.id %}">{{product.title}}</a>
                        </h3>
                        <span class="price">
                            <span class="lynessa-Price-amount amount">
                                <ins>
                                    <span class="lynessa-Price-currencySymbol">₹</span>
                                    <span class="lynessa-Price-amount amount discount-amount InrToUsdDiscountPrice65">
                                        {{product.price}}
                                    </span>
                                </ins>
                            </span>
                        </span>
                    </div>
                </div>
        
            </li>
        {% endfor %}
    </ul>
    {% endblock %}

функции динамического отображения таблицы

def shoppingpage(request):
    cat = Category.objects.filter(isactive=True)
    subcat = SUBCategories.objects.filter(isactive=True)
    # category= CategorySerializer(cat,many=True)
    # subcategory = SUBCategoriesSerializer(subcat,many=True)
    hm = {'category':cat,'subcategory':subcat}
    return render(request,'polls/shoppingpage.html',hm)

Грамотно оцените помощь, спасибо!

Вернуться на верх