[Fixed]-Django: one-to-many relationship and reverse lookup

1πŸ‘

βœ…

I don’t know why you think you need to put anything there. You just want to send all the orders to the template, then iterate through them their articles there.

myOrder = Order.objects.all()

…

{% for order in myOrder %}
    {{ order.ord_someinformation }}
    {% for article in order.articles_set.all %}
        {{ article.detail_article }}
    {% endif %}
{% endif %}

Leave a comment