Html 如何在django模板中创建水平产品列表视图
如何在django模板中创建水平产品列表视图 您可以在这里查看我的产品列表图像 : views.pyHtml 如何在django模板中创建水平产品列表视图,html,django,django-templates,Html,Django,Django Templates,如何在django模板中创建水平产品列表视图 您可以在这里查看我的产品列表图像 : views.py class ProductView(ListView): model = Product queryset = Product.objects.all() fields = "__all__" template_name = "demoapp/product.html" product.html: {% for product in object_list
class ProductView(ListView):
model = Product
queryset = Product.objects.all()
fields = "__all__"
template_name = "demoapp/product.html"
product.html:
{% for product in object_list %}
<div class='row'>
<div class="col-sm-6 col-md-4 col-lg-3 p-b-35 isotope-item men {{ col_class_set }}">
<!-- Block2 -->
<div class="block2">
<div class="block2-pic hov-img0">
<img src="{{ product.image.url }}" alt="IMG-PRODUCT">
<a href="#" class="block2-btn flex-c-m stext-103 cl2 size-102 bg0 bor2 hov-btn1 p-lr-15 trans-04 js-show-modal1">
Quick View
</a>
</div>
<div class="block2-txt flex-w flex-t p-t-14">
<div class="block2-txt-child1 flex-col-l ">
<a href="product-detail.html" class="stext-104 cl4 hov-cl1 trans-04 js-name-b2 p-b-6">
{{product.title}}
</a>
<span class="stext-105 cl3">
${{product.price}}
</span>
</div>
<div class="block2-txt-child2 flex-r p-t-3">
<a href="#" class="btn-addwish-b2 dis-block pos-relative js-addwish-b2">
<img class="icon-heart1 dis-block trans-04" src="images/icons/icon-heart-01.png" alt="ICON">
<img class="icon-heart2 dis-block trans-04 ab-t-l" src="{% static "images/icons/icon-heart-02.png" %}" alt="ICON">
</a>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
{%用于对象列表%中的产品]
${{product.price}
{%endfor%}
试试这个
That is not achieve by django. Try changing in your html. just change your
<div class="col-sm-4> or <div class="col-sm-3> as per your requirements.
<div class='row'>
{% for product in object_list %}
<div class="col-sm-6 col-md-4 col-lg-3 p-b-35 isotope-item men {{ col_class_set }}">
<!-- Block2 -->
<div class="block2">
<div class="block2-pic hov-img0">
<img src="{{ product.image.url }}" alt="IMG-PRODUCT">
<a href="#" class="block2-btn flex-c-m stext-103 cl2 size-102 bg0 bor2 hov-btn1 p-lr-15 trans-04 js-show-modal1">
Quick View
</a>
</div>
<div class="block2-txt flex-w flex-t p-t-14">
<div class="block2-txt-child1 flex-col-l ">
<a href="product-detail.html" class="stext-104 cl4 hov-cl1 trans-04 js-name-b2 p-b-6">
{{product.title}}
</a>
<span class="stext-105 cl3">
${{product.price}}
</span>
</div>
<div class="block2-txt-child2 flex-r p-t-3">
<a href="#" class="btn-addwish-b2 dis-block pos-relative js-addwish-b2">
<img class="icon-heart1 dis-block trans-04" src="images/icons/icon-heart-01.png" alt="ICON">
<img class="icon-heart2 dis-block trans-04 ab-t-l" src="{% static "images/icons/icon-heart-02.png" %}" alt="ICON">
</a>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
django无法实现的。尝试在html中进行更改。只要换个衣服就行了
根据您的要求。
{对象_列表%中的产品的百分比}
${{product.price}
{%endfor%}
试试这个
That is not achieve by django. Try changing in your html. just change your
<div class="col-sm-4> or <div class="col-sm-3> as per your requirements.
<div class='row'>
{% for product in object_list %}
<div class="col-sm-6 col-md-4 col-lg-3 p-b-35 isotope-item men {{ col_class_set }}">
<!-- Block2 -->
<div class="block2">
<div class="block2-pic hov-img0">
<img src="{{ product.image.url }}" alt="IMG-PRODUCT">
<a href="#" class="block2-btn flex-c-m stext-103 cl2 size-102 bg0 bor2 hov-btn1 p-lr-15 trans-04 js-show-modal1">
Quick View
</a>
</div>
<div class="block2-txt flex-w flex-t p-t-14">
<div class="block2-txt-child1 flex-col-l ">
<a href="product-detail.html" class="stext-104 cl4 hov-cl1 trans-04 js-name-b2 p-b-6">
{{product.title}}
</a>
<span class="stext-105 cl3">
${{product.price}}
</span>
</div>
<div class="block2-txt-child2 flex-r p-t-3">
<a href="#" class="btn-addwish-b2 dis-block pos-relative js-addwish-b2">
<img class="icon-heart1 dis-block trans-04" src="images/icons/icon-heart-01.png" alt="ICON">
<img class="icon-heart2 dis-block trans-04 ab-t-l" src="{% static "images/icons/icon-heart-02.png" %}" alt="ICON">
</a>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
django无法实现的。尝试在html中进行更改。只要换个衣服就行了
根据您的要求。
{对象_列表%中的产品的百分比}
${{product.price}
{%endfor%}
我以垂直对齐的方式获取产品列表,我希望以水平对齐的方式获取产品列表。任何帮助都将不胜感激。我正在以垂直对齐的方式获取我的产品列表,我想以水平方式进行。任何帮助都将不胜感激。