mirror of
https://github.com/django/django.git
synced 2024-12-24 18:16:19 +00:00
10e3faf191
It contained models, forms and admin objects causing undesirable import side effects. Refs #16368. Thanks to Ramiro, Carl and Loïc for the review.
47 lines
1.0 KiB
Python
47 lines
1.0 KiB
Python
from django.contrib import admin
|
|
from django.contrib.contenttypes.admin import GenericTabularInline
|
|
|
|
from .models import (Media, PhoneNumber, Episode, EpisodeExtra, Contact,
|
|
Category, EpisodePermanent, EpisodeMaxNum)
|
|
|
|
|
|
site = admin.AdminSite(name="admin")
|
|
|
|
|
|
class MediaInline(GenericTabularInline):
|
|
model = Media
|
|
|
|
|
|
class EpisodeAdmin(admin.ModelAdmin):
|
|
inlines = [
|
|
MediaInline,
|
|
]
|
|
|
|
|
|
class MediaExtraInline(GenericTabularInline):
|
|
model = Media
|
|
extra = 0
|
|
|
|
|
|
class MediaMaxNumInline(GenericTabularInline):
|
|
model = Media
|
|
extra = 5
|
|
max_num = 2
|
|
|
|
|
|
class PhoneNumberInline(GenericTabularInline):
|
|
model = PhoneNumber
|
|
|
|
|
|
class MediaPermanentInline(GenericTabularInline):
|
|
model = Media
|
|
can_delete = False
|
|
|
|
|
|
site.register(Episode, EpisodeAdmin)
|
|
site.register(EpisodeExtra, inlines=[MediaExtraInline])
|
|
site.register(EpisodeMaxNum, inlines=[MediaMaxNumInline])
|
|
site.register(Contact, inlines=[PhoneNumberInline])
|
|
site.register(Category)
|
|
site.register(EpisodePermanent, inlines=[MediaPermanentInline])
|