[Solved] Django: how to get order_detail_data as per order_id
If you are using raw queries, then you just need to merge the data. Something like this should work, def merge_order_data_and_detail(orders, details): “””Group details by order_id and merge it in orders.””” # create dictionary key:order_id value:[order_detail_data] dic = {} for d in details: if d[‘order_id’] not in dic: dic[d[‘order_id’]] = [] dic[d[‘order_id’]].append(d) # iterate orders … Read more