[Fixed]-Django: select data from 2 models

1👍

ResourcePool.objects.filter(order_id__pk=26).values('orders__created','email','item_a',item_b','item_c')

try this

0👍

try this

order = Orders.objects.get(pk=26)
resource=ResourcePool.objects.filter(order_id=order.id).select_related()

And to obtain the data of “Orders”

id_order_pk26 = resource.order_id.order_id
created_pk26 = resource.order_id.created

Leave a comment