fix ticket view after order<>opr change
This commit is contained in:
parent
02424115f2
commit
2ca5fb5314
|
@ -19,14 +19,14 @@ class ShopTicketListView(LoginRequiredMixin, ListView):
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
tickets = super(ShopTicketListView, self).get_queryset()
|
tickets = super(ShopTicketListView, self).get_queryset()
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
return tickets.filter(order__user=user).order_by("ticket_type__camp")
|
return tickets.filter(opr__order__user=user).order_by("ticket_type__camp")
|
||||||
|
|
||||||
|
|
||||||
class ShopTicketDownloadView(LoginRequiredMixin, SingleObjectMixin, View):
|
class ShopTicketDownloadView(LoginRequiredMixin, SingleObjectMixin, View):
|
||||||
model = ShopTicket
|
model = ShopTicket
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
if not request.user == self.get_object().order.user:
|
if not request.user == self.get_object().opr.order.user:
|
||||||
raise Http404("Ticket not found")
|
raise Http404("Ticket not found")
|
||||||
|
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
@ -54,6 +54,6 @@ class ShopTicketDetailView(LoginRequiredMixin, UpdateView, DetailView):
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
ticket = self.get_object()
|
ticket = self.get_object()
|
||||||
if ticket.order.user != request.user:
|
if ticket.opr.order.user != request.user:
|
||||||
raise Http404("Ticket not found")
|
raise Http404("Ticket not found")
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
Loading…
Reference in a new issue