hello All,
I am a beginner to programming and have a query regarding passing the data to index.html from views .py in Django
Building a dynamic fashion website using Django. trying to pass ‘collection’ to index.html and it works fine for the womens container section. And similarly i got a Mens sections and how can i pass the data and apply using a for loop similar to what i have done for Womens section.
Plan is i can create objects similar to womens for mens and need to pass data to another for loop for mens section in html and display the relevant data. Is that possible ?
from views.py
womens_success = Fashion()
womens_success.item = ‘General Collection’
womens_success.img = ‘instagram-01.jpg’
womens_success.price = ‘£150’
womens_success.offer = False
collection = [womens_winter, womens_autumn, womens_spring, womens_general,womens_success]
return render(request,'index.html', {'collections': collection},)
from index.html
<section class="section" id="men">
<div class="container">
<div class="row">
<div class="col-lg-6">
<div class="section-heading">
<h2> Womens's Latest</h2>
<span>Details is what makes All Seasons different from the other themes.</span>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="men-item-carousel">
<div class="owl-men-item owl-carousel">
{% for womens in collections %}
<div class="item">
<div class="thumb">
<!--{% if womens.offer %}
<div class= "text-center"><a href ="#"> On Offer</a></div>
{%endif%}-->
<img src= "{{baseUrl}}/{{womens.img}}" alt="">
</div>
<div class="down-content">
<h4>{{womens.item}}</h4>
<span>{{womens.price}}</span>
<ul class="stars">
<li><i class="fa fa-star"></i></li>
<li><i class="fa fa-star"></i></li>
<li><i class="fa fa-star"></i></li>
<li><i class="fa fa-star"></i></li>
<li><i class="fa fa-star"></i></li>
</ul>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</section>
<!-- ***** Women Area Ends ***** -->