mirror of
https://github.com/django/django.git
synced 2025-08-31 15:57:45 +00:00
Merged regressiontests and modeltests into the test root.
This commit is contained in:
parent
b3d2ccb5bf
commit
89f40e3624
1050 changed files with 0 additions and 0 deletions
47
tests/generic_inline_admin/admin.py
Normal file
47
tests/generic_inline_admin/admin.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.contenttypes import generic
|
||||
|
||||
from .models import (Media, PhoneNumber, Episode, EpisodeExtra, Contact,
|
||||
Category, EpisodePermanent, EpisodeMaxNum)
|
||||
|
||||
|
||||
site = admin.AdminSite(name="admin")
|
||||
|
||||
class MediaInline(generic.GenericTabularInline):
|
||||
model = Media
|
||||
|
||||
|
||||
class EpisodeAdmin(admin.ModelAdmin):
|
||||
inlines = [
|
||||
MediaInline,
|
||||
]
|
||||
|
||||
|
||||
class MediaExtraInline(generic.GenericTabularInline):
|
||||
model = Media
|
||||
extra = 0
|
||||
|
||||
|
||||
class MediaMaxNumInline(generic.GenericTabularInline):
|
||||
model = Media
|
||||
extra = 5
|
||||
max_num = 2
|
||||
|
||||
|
||||
class PhoneNumberInline(generic.GenericTabularInline):
|
||||
model = PhoneNumber
|
||||
|
||||
|
||||
class MediaPermanentInline(generic.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])
|
Loading…
Add table
Add a link
Reference in a new issue