2016-05-10 20:20:01 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2016-05-25 17:13:45 +00:00
|
|
|
from . import models
|
2016-05-10 20:20:01 +00:00
|
|
|
|
2016-05-25 17:13:45 +00:00
|
|
|
admin.site.register(models.EpayCallback)
|
|
|
|
admin.site.register(models.EpayPayment)
|
2016-05-29 10:54:02 +00:00
|
|
|
admin.site.register(models.CoinifyAPIInvoice)
|
2016-05-29 17:33:26 +00:00
|
|
|
admin.site.register(models.CoinifyAPICallback)
|
2016-05-29 10:54:02 +00:00
|
|
|
admin.site.register(models.Invoice)
|
2016-05-25 17:13:45 +00:00
|
|
|
|
2016-05-31 21:23:05 +00:00
|
|
|
|
2016-05-25 17:13:45 +00:00
|
|
|
@admin.register(models.ProductCategory)
|
2016-05-10 20:20:01 +00:00
|
|
|
class ProductCategoryAdmin(admin.ModelAdmin):
|
|
|
|
list_display = [
|
|
|
|
'name',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2016-05-25 17:13:45 +00:00
|
|
|
@admin.register(models.Product)
|
2016-05-10 20:20:01 +00:00
|
|
|
class ProductAdmin(admin.ModelAdmin):
|
|
|
|
list_display = [
|
|
|
|
'name',
|
|
|
|
'category',
|
|
|
|
'price',
|
|
|
|
'available_in',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class ProductInline(admin.TabularInline):
|
2016-05-25 17:13:45 +00:00
|
|
|
model = models.OrderProductRelation
|
2016-05-10 20:20:01 +00:00
|
|
|
|
|
|
|
|
2016-05-25 18:05:31 +00:00
|
|
|
class TicketInline(admin.TabularInline):
|
|
|
|
model = models.Ticket
|
|
|
|
exclude = ['qrcode_base64']
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-25 17:13:45 +00:00
|
|
|
@admin.register(models.Order)
|
2016-05-10 20:20:01 +00:00
|
|
|
class OrderAdmin(admin.ModelAdmin):
|
2016-05-31 21:23:05 +00:00
|
|
|
change_form_template = 'admin/change_order_form.html'
|
2016-05-10 20:20:01 +00:00
|
|
|
list_display = [
|
2016-05-31 20:15:56 +00:00
|
|
|
'id',
|
2016-05-10 20:20:01 +00:00
|
|
|
'user',
|
|
|
|
'camp',
|
|
|
|
'payment_method',
|
|
|
|
'paid',
|
|
|
|
]
|
|
|
|
|
|
|
|
list_filter = [
|
|
|
|
'user',
|
|
|
|
'camp',
|
|
|
|
'payment_method',
|
|
|
|
'paid',
|
|
|
|
]
|
|
|
|
|
|
|
|
exclude = ['products']
|
|
|
|
|
2016-05-25 18:05:31 +00:00
|
|
|
inlines = [ProductInline, TicketInline]
|
|
|
|
|
|
|
|
actions = ['mark_order_as_paid']
|
|
|
|
|
|
|
|
def mark_order_as_paid(self, request, queryset):
|
|
|
|
for order in queryset.filter(paid=False):
|
|
|
|
order.mark_as_paid()
|
|
|
|
mark_order_as_paid.description = 'Mark order(s) as paid'
|
2016-05-10 20:20:01 +00:00
|
|
|
|
2016-05-25 17:13:45 +00:00
|
|
|
|
|
|
|
@admin.register(models.Ticket)
|
|
|
|
class TicketAdmin(admin.ModelAdmin):
|
2016-05-31 21:23:05 +00:00
|
|
|
pass
|