bornhack-website/src/tickets/admin.py

72 lines
1.2 KiB
Python
Raw Normal View History

2017-08-17 15:51:24 +00:00
from django.contrib import admin
from .models import (
TicketType,
SponsorTicket,
DiscountTicket,
ShopTicket
)
class BaseTicketAdmin(admin.ModelAdmin):
actions = ['generate_pdf']
exclude = ['qrcode_base64']
def generate_pdf(self, request, queryset):
for ticket in queryset.all():
ticket.generate_pdf()
generate_pdf.description = 'Generate PDF for the ticket'
@admin.register(TicketType)
class TicketTypeAdmin(admin.ModelAdmin):
2017-08-19 23:01:44 +00:00
list_display = [
'name',
'camp',
]
list_filter = [
'name',
'camp',
]
2017-08-17 15:51:24 +00:00
@admin.register(SponsorTicket)
class SponsorTicketAdmin(BaseTicketAdmin):
2017-08-19 23:01:44 +00:00
list_display = [
'pk',
'ticket_type',
'sponsor',
'checked_in',
]
list_filter = [
'ticket_type',
'sponsor',
'checked_in',
]
2017-08-17 15:51:24 +00:00
@admin.register(DiscountTicket)
class DiscountTicketAdmin(BaseTicketAdmin):
pass
@admin.register(ShopTicket)
class ShopTicketAdmin(BaseTicketAdmin):
2017-08-19 23:01:44 +00:00
list_display = [
'pk',
'ticket_type',
'order',
'product',
'checked_in',
]
list_filter = [
'ticket_type',
'order',
'product',
'checked_in',
]