'# Regression test for #9932 - exclude in InlineModelAdmin
# should not contain the ForeignKey field used in ModelAdmin.model'

def test_exclude_inline_model_admin(self):

    class SongInline(admin.StackedInline, ):
        model = Song
        exclude = ['album']
    class AlbumAdmin(admin.ModelAdmin, ):
        model = Album
        inlines = [SongInline]
    self.assertRaisesMessage(ImproperlyConfigured, "SongInline    cannot    exclude    the    field    'album'    -    this    is    the    foreign    key    to    the    parent    model    Album.", validate, AlbumAdmin, Album)
