mirror of
https://github.com/django/django.git
synced 2024-12-28 03:55:50 +00:00
4ef10f245a
Thanks Stephen Burrows for work on the patch as well.
Forwardport of 2914f66983
from stable/1.7.x
34 lines
720 B
Python
34 lines
720 B
Python
from django.contrib import admin
|
|
from django.contrib.contenttypes.admin import GenericTabularInline
|
|
|
|
from .models import (Media, PhoneNumber, Episode, Contact,
|
|
Category, EpisodePermanent)
|
|
|
|
|
|
site = admin.AdminSite(name="admin")
|
|
|
|
|
|
class MediaInline(GenericTabularInline):
|
|
model = Media
|
|
|
|
|
|
class EpisodeAdmin(admin.ModelAdmin):
|
|
inlines = [
|
|
MediaInline,
|
|
]
|
|
|
|
|
|
class PhoneNumberInline(GenericTabularInline):
|
|
model = PhoneNumber
|
|
|
|
|
|
class MediaPermanentInline(GenericTabularInline):
|
|
model = Media
|
|
can_delete = False
|
|
|
|
|
|
site.register(Episode, EpisodeAdmin)
|
|
site.register(Contact, inlines=[PhoneNumberInline])
|
|
site.register(Category)
|
|
site.register(EpisodePermanent, inlines=[MediaPermanentInline])
|