#NEWLINE# def formfield_for_dbfield( self , db_field , **kwargs ) : #NEWLINE# #INDENT# names = [ f . fk_field for f in self . model . _meta . virtual_fields if ( f . name in self . generic_fields ) ] #NEWLINE# if ( db_field . name in names ) : #NEWLINE# #INDENT# for gfk in self . model . _meta . virtual_fields : #NEWLINE# #INDENT# if ( gfk . fk_field == self . name ) : #NEWLINE# #INDENT# kwargs [ 'widget' ] = GenericForeignKeyRawIdWidget ( gfk . ct_field , self . admin_site . _registry . keys ( ) ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return super ( PermissionAdmin , self ) . formfield_for_dbfield ( db_field , ** kwargs )