diff --git a/shop/views.py b/shop/views.py index d73cc938..79cbdea1 100644 --- a/shop/views.py +++ b/shop/views.py @@ -35,6 +35,11 @@ class CheckoutView(LoginRequiredMixin, DetailView): template_name = 'shop/order_detail.html' context_object_name = 'order' + def get(self, request, *args, **kwargs): + if self.get_object().user != request.user: + raise Http404("Order not found") + return self.render_to_response(self.get_context_data()) + class PaymentView(LoginRequiredMixin, FormView): """