The video has shown to get the following items :order.id, order.customer.first_name to display on the html/webpage.
But, how to get Product title from the orderitem_set__product prefetch_related field for displaying it via template.html?
I have tried: order.orderitem_set.product.title…, but no use!
1 Like
I too would like to know! In the HTML template I’ve tried:
{{ order.title }}
{{ order.product.title }}
{{ order.orderitem.product.title }}
{{ order.orderitem_set.product.title }}
I’ve also tried to simply pull the unit_price from the OrderItem model with:
{{ order.orderitem.unit_price}}
and
{{ order.orderitem_set.unit_price}}
but even that doesn’t work. Possibly something we don’t know about HTML?
i tried shortly.
but dont know how to inspect really a queryset.
anybody knows?
anyhow: every order has several orderitems, where each orderitem has one product with a title.
so i assume we have to somehow iterate over the orderitems.
i tried:
does not give an exception, but also no output of titles…
1 Like