'The custom ModelForm\'s `Meta.exclude` is respected when used in
conjunction with `ModelAdmin.readonly_fields` and when no
`ModelAdmin.exclude` is defined (#14496).'

def test_custom_form_meta_exclude_with_readonly(self):

    class AdminBandForm(forms.ModelForm, ):
        class Meta:
            model = Band
            exclude = ['bio']
    class BandAdmin(ModelAdmin, ):
        readonly_fields = ['name']
        form = AdminBandForm
    ma = BandAdmin(Band, self.site)
    self.assertEqual(list(ma.get_form(request).base_fields), ['sign_date'])
    class AdminConcertForm(forms.ModelForm, ):
        class Meta:
            model = Concert
            exclude = ['day']
    class ConcertInline(TabularInline, ):
        readonly_fields = ['transport']
        form = AdminConcertForm
        fk_name = 'main_band'
        model = Concert
    class BandAdmin(ModelAdmin, ):
        inlines = [ConcertInline]
    ma = BandAdmin(Band, self.site)
    self.assertEqual(list(list(ma.get_formsets_with_inlines(request))[0][0]().forms[0].fields), ['main_band', 'opening_band', 'id', 'DELETE'])
