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