Coverage for /home/tribaal/workspace/django-shop/shop/views/order: 100.00%

# Coverage for /home/tribaal/workspace/django-shop/shop/views/order : 100.00%

## 20 statements 20 run 0 missing 0 excluded 0 partial

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from shop.views import ShopListView, ShopDetailView from shop.models import Order class OrderListView(ShopListView): """ Display list or orders for logged in user. """ queryset = Order.objects.all() def get_queryset(self): queryset = super(OrderListView, self).get_queryset() queryset = queryset.filter(user=self.request.user) return queryset @method_decorator(login_required) def dispatch(self, *args, **kwargs): return super(OrderListView, self).dispatch(*args, **kwargs) class OrderDetailView(ShopDetailView): """ Display order for logged in user. """ queryset = Order.objects.all() def get_queryset(self): queryset = super(OrderDetailView, self).get_queryset() queryset = queryset.filter(user=self.request.user) return queryset @method_decorator(login_required) def dispatch(self, *args, **kwargs): return super(OrderDetailView, self).dispatch(*args, **kwargs)