mirror of
https://github.com/django/django.git
synced 2024-11-19 16:04:13 +00:00
7b21bfc074
prevent test order dependant failures. This involves introducing usage of `TestCase.urls` and implementing proper admin.py modules for some of the test apps. Thanks Florian Apolloner for finding the issue and contributing the patch. Refs #15294 (it solves these problems so the fix for that ticket we are going to commit doesn't introduce obscure and hard to reproduce test failures when running the Django test suite.) git-svn-id: http://code.djangoproject.com/svn/django/trunk@16856 bcc190cf-cafb-0310-a4f2-bffc1f526a37
45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
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])
|