mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #10799: fixed the use of list_editable with model inheritance and custom one-to-one parent links. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10590 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -269,6 +269,16 @@ class PodcastAdmin(admin.ModelAdmin):
|
||||
|
||||
ordering = ('name',)
|
||||
|
||||
class Vodcast(Media):
|
||||
media = models.OneToOneField(Media, primary_key=True, parent_link=True)
|
||||
released = models.BooleanField(default=False)
|
||||
|
||||
class VodcastAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'released')
|
||||
list_editable = ('released',)
|
||||
|
||||
ordering = ('name',)
|
||||
|
||||
class Parent(models.Model):
|
||||
name = models.CharField(max_length=128)
|
||||
|
||||
@@ -327,6 +337,7 @@ admin.site.register(Subscriber, SubscriberAdmin)
|
||||
admin.site.register(ExternalSubscriber, ExternalSubscriberAdmin)
|
||||
admin.site.register(OldSubscriber, OldSubscriberAdmin)
|
||||
admin.site.register(Podcast, PodcastAdmin)
|
||||
admin.site.register(Vodcast, VodcastAdmin)
|
||||
admin.site.register(Parent, ParentAdmin)
|
||||
admin.site.register(EmptyModel, EmptyModelAdmin)
|
||||
admin.site.register(Fabric, FabricAdmin)
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
import re
|
||||
import datetime
|
||||
import os
|
||||
|
||||
from django.core.files import temp as tempfile
|
||||
from django.test import TestCase
|
||||
from django.contrib.auth.models import User, Permission
|
||||
@@ -18,7 +16,7 @@ from django.utils.html import escape
|
||||
from models import (Article, BarAccount, CustomArticle, EmptyModel,
|
||||
ExternalSubscriber, FooAccount, Gallery,
|
||||
ModelWithStringPrimaryKey, Person, Persona, Picture,
|
||||
Podcast, Section, Subscriber)
|
||||
Podcast, Section, Subscriber, Vodcast)
|
||||
|
||||
try:
|
||||
set
|
||||
@@ -801,6 +799,11 @@ class AdminViewListEditable(TestCase):
|
||||
response = self.client.get('/test_admin/admin/admin_views/podcast/')
|
||||
self.failUnlessEqual(response.status_code, 200)
|
||||
|
||||
def test_inheritance_2(self):
|
||||
Vodcast.objects.create(name="This Week in Django", released=True)
|
||||
response = self.client.get('/test_admin/admin/admin_views/vodcast/')
|
||||
self.failUnlessEqual(response.status_code, 200)
|
||||
|
||||
def test_changelist_input_html(self):
|
||||
response = self.client.get('/test_admin/admin/admin_views/person/')
|
||||
# 2 inputs per object(the field and the hidden id field) = 6
|
||||
|
||||
Reference in New Issue
Block a user