Spot the bug in the order view

from Django
Django 6.0.8 / Python 3.14 intermediate 4 min 1 issue to find

Find the authorization flaw in this generated order view.

Python
@login_required
def order_detail(request, order_id):
    order = get_object_or_404(Order, pk=order_id)
    return JsonResponse(
        {
            "reference": order.reference,
            "shipping_address": order.shipping_address,
        }
    )
Open in playground
Report an error