Ticket #10799: list_editable_and_parent_link.diff

File list_editable_and_parent_link.diff, 2.3 KB (added by Will Hardy, 16 years ago)

Regression test showing this bug in action

  • tests/regressiontests/admin_views/tests.py

     
    1313from django.utils.html import escape
    1414
    1515# local test models
    16 from models import Article, CustomArticle, Section, ModelWithStringPrimaryKey, Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber, Podcast, EmptyModel
     16from models import Article, CustomArticle, Section, ModelWithStringPrimaryKey, Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber, Vodcast, Podcast, EmptyModel
    1717
    1818try:
    1919    set
     
    796796        response = self.client.get('/test_admin/admin/admin_views/podcast/')
    797797        self.failUnlessEqual(response.status_code, 200)
    798798
     799    def test_inheritance_2(self):
     800        Vodcast.objects.create(name="This Week in Django", released=True)
     801        response = self.client.get('/test_admin/admin/admin_views/vodcast/')
     802        self.failUnlessEqual(response.status_code, 200)
     803
    799804    def test_changelist_input_html(self):
    800805        response = self.client.get('/test_admin/admin/admin_views/person/')
    801806        # 2 inputs per object(the field and the hidden id field) = 6
  • tests/regressiontests/admin_views/models.py

     
    266266
    267267    ordering = ('name',)
    268268
     269class Vodcast(Media):
     270    media = models.OneToOneField(Media, primary_key=True, parent_link=True)
     271    released = models.BooleanField(default=False)
     272
     273class VodcastAdmin(admin.ModelAdmin):
     274    list_display = ('name', 'released')
     275    list_editable = ('released',)
     276
     277    ordering = ('name',)
     278
    269279class Parent(models.Model):
    270280    name = models.CharField(max_length=128)
    271281
     
    303313admin.site.register(ExternalSubscriber, ExternalSubscriberAdmin)
    304314admin.site.register(OldSubscriber, OldSubscriberAdmin)
    305315admin.site.register(Podcast, PodcastAdmin)
     316admin.site.register(Vodcast, VodcastAdmin)
    306317admin.site.register(Parent, ParentAdmin)
    307318admin.site.register(EmptyModel, EmptyModelAdmin)
    308319admin.site.register(Fabric, FabricAdmin)
Back to Top