'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]
    errors = AlbumAdmin(Album, AdminSite()).check()
    expected = [checks.Error("Cannot    exclude    the    field    'album',    because    it    is    the    foreign    key    to    the    parent    model    'admin_checks.Album'.", obj=SongInline, id='admin.E201')]
    self.assertEqual(errors, expected)
