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-06-04 07:46:10 +00:00
|
|
|
|
|
|
|
def get_email(self, obj):
|
|
|
|
return obj.user.email
|
|
|
|
|
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',
|
2016-06-04 07:46:10 +00:00
|
|
|
'get_email',
|
2016-06-04 07:37:54 +00:00
|
|
|
'total',
|
2016-05-10 20:20:01 +00:00
|
|
|
'payment_method',
|
2016-06-04 07:37:54 +00:00
|
|
|
'open',
|
2016-05-10 20:20:01 +00:00
|
|
|
'paid',
|
2016-06-01 09:10:06 +00:00
|
|
|
'cancelled',
|
2016-05-10 20:20:01 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
list_filter = [
|
|
|
|
'user',
|
|
|
|
'camp',
|
|
|
|
'payment_method',
|
2016-06-04 07:37:54 +00:00
|
|
|
'open',
|
2016-05-10 20:20:01 +00:00
|
|
|
'paid',
|
2016-06-04 07:37:54 +00:00
|
|
|
'cancelled',
|
2016-05-10 20:20:01 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
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
|