Django PART-1 Django ORM Video Lecture-13 #Selecting Related Objects

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?