Adding TicketListView

This commit is contained in:
Víðir Valberg Guðmundsson 2016-05-30 22:50:43 +02:00
parent 539b3ee105
commit 700b876fd3
4 changed files with 14 additions and 0 deletions

View file

View file

View file

@ -20,6 +20,8 @@ urlpatterns = [
url(r'orders/(?P<pk>[0-9]+)/pay/banktransfer/$', BankTransferView.as_view(), name='bank_transfer'),
url(r'tickets/', TicketListView.as_view(), name='ticket_list'),
url(r'privacy-policy/', TemplateView.as_view(template_name='law/privacy_policy.html'), name='privacy-policy'),
url(r'return-policy/', TemplateView.as_view(template_name='law/return_policy.html'), name='return-policy'),
url(r'general-terms-and-conditions/', TemplateView.as_view(template_name='law/general_terms_and_conditions.html'), name='general-terms')

View file

@ -27,6 +27,7 @@ from shop.models import (
EpayPayment,
CoinifyAPIInvoice,
CoinifyAPICallback,
Ticket,
)
from .forms import AddToOrderForm
from .epay import calculate_epay_hash, validate_epay_callback
@ -474,3 +475,14 @@ class CoinifyThanksView(LoginRequiredMixin, EnsureUserOwnsOrderMixin, EnsureClos
model = Order
template_name = 'coinify_thanks.html'
class TicketListView(LoginRequiredMixin, ListView):
model = Ticket
template_name = 'ticket_list.html'
context_object_name = 'tickets'
def get_queryset(self):
tickets = super(TicketListView, self).get_queryset()
user = self.request.user
return tickets.filter(order__user=user)