[Fixed]-Django filter child by parent

1👍

I think you are looking for this

{% for house in home %}
<div class="row">
    <div class="col-md-6 portfolio-item">
        <a href="house1.html">
            <img class="img-responsive" src=" media/{{ house.photo }}" alt="">
        </a>
        <h3>
            <a href="house1.html">House</a>
        </h3>
        <ul>
            {% for i in house.amenities_set.all %}
            <li>{{ i.amenities }}</li>
            {% endfor %}
        </ul>
    </div>
</div>
{% endfor %} 
👤Anoop

Leave a comment