Code Room
Code reviewMedium
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.
Learn the concepts
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 outRun or narrate your approach, then ask the coach.