Code Room
Code reviewMediumcr-g542
Subject Code reviewLevel Mid–Senior~18 minCommon in Databases & SQL interviewsIndustries Software development

Question

Review this Python/Django-style serializer that builds an order summary.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewpython
def order_summary(order_ids):    out = []    for oid in order_ids:        order = Order.objects.get(id=oid)        lines = []        for item in order.items.all():            lines.append({                "product": item.product.name,                "price": item.product.price,            })        out.append({"order": order.id, "lines": lines})    return out
Run or narrate your approach, then ask the coach.