2011-09-21 02:16:49 +08:00
|
|
|
from django.contrib import admin
|
2014-01-22 14:43:33 +08:00
|
|
|
from django.contrib.contenttypes.admin import GenericTabularInline
|
2011-09-21 02:16:49 +08:00
|
|
|
|
2015-01-28 20:35:27 +08:00
|
|
|
from .models import Category, Contact, Episode, EpisodePermanent, Media, PhoneNumber
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2011-09-21 02:16:49 +08:00
|
|
|
site = admin.AdminSite(name="admin")
|
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2014-01-22 14:43:33 +08:00
|
|
|
class MediaInline(GenericTabularInline):
|
2011-09-21 02:16:49 +08:00
|
|
|
model = Media
|
|
|
|
|
|
|
|
|
|
|
|
class EpisodeAdmin(admin.ModelAdmin):
|
|
|
|
inlines = [
|
|
|
|
MediaInline,
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2014-01-22 14:43:33 +08:00
|
|
|
class PhoneNumberInline(GenericTabularInline):
|
2011-09-21 02:16:49 +08:00
|
|
|
model = PhoneNumber
|
|
|
|
|
|
|
|
|
2014-01-22 14:43:33 +08:00
|
|
|
class MediaPermanentInline(GenericTabularInline):
|
2011-09-21 02:16:49 +08:00
|
|
|
model = Media
|
|
|
|
can_delete = False
|
|
|
|
|
|
|
|
|
|
|
|
site.register(Episode, EpisodeAdmin)
|
|
|
|
site.register(Contact, inlines=[PhoneNumberInline])
|
|
|
|
site.register(Category)
|
|
|
|
site.register(EpisodePermanent, inlines=[MediaPermanentInline])
|