'Test that widget instances in formfield_overrides are not shared between
different fields. (#19423)'

def testFormfieldOverridesWidgetInstances(self):

    class BandAdmin(admin.ModelAdmin, ):
        formfield_overrides = {CharField: {u'widget': forms.TextInput(attrs={u'size': u'10'})}}
    ma = BandAdmin(models.Band, admin.site)
    f1 = ma.formfield_for_dbfield(models.Band._meta.get_field(u'name'), request=None)
    f2 = ma.formfield_for_dbfield(models.Band._meta.get_field(u'style'), request=None)
    self.assertNotEqual(f1.widget, f2.widget)
    self.assertEqual(f1.widget.attrs[u'maxlength'], u'100')
    self.assertEqual(f2.widget.attrs[u'maxlength'], u'20')
    self.assertEqual(f2.widget.attrs[u'size'], u'10')
