dynamicweb/digitalglarus/admin.py

36 lines
1.2 KiB
Python
Raw Normal View History

from django.contrib import admin
from .models import DGGallery, DGPicture, Booking, BookingPrice,\
2016-12-05 00:44:26 +00:00
MembershipOrder, Membership, MembershipType, BookingOrder, BookingCancellation
2016-12-05 00:44:26 +00:00
from django.core.urlresolvers import reverse
from utils.models import ContactMessage
2016-12-05 00:44:26 +00:00
from django.utils.html import format_html
2016-04-01 10:37:01 +00:00
class DGPictureInline(admin.StackedInline):
model = DGPicture
2016-12-05 00:44:26 +00:00
2016-04-01 10:37:01 +00:00
class DGGalleryAdmin(admin.ModelAdmin):
inlines = [DGPictureInline]
2016-12-05 00:44:26 +00:00
class BookingCancellationAdmin(admin.ModelAdmin):
list_display = ('id', 'get_order', 'created_at', 'required_refund', 'refund')
def get_order(self, obj):
order = obj.order
order_url = reverse("admin:digitalglarus_bookingorder_change", args=[order.id])
return format_html("<a href='{url}'>{order_id}</a>", url=order_url, order_id=order.id)
2016-04-01 10:37:01 +00:00
admin.site.register(DGGallery, DGGalleryAdmin)
admin.site.register(ContactMessage)
admin.site.register(Booking)
admin.site.register(BookingPrice)
admin.site.register(MembershipOrder)
admin.site.register(Membership)
admin.site.register(MembershipType)
admin.site.register(BookingOrder)
2016-12-05 00:44:26 +00:00
admin.site.register(BookingCancellation, BookingCancellationAdmin)