<s> from salmonella . widgets import SalmonellaIdWidget , SalmonellaMultiIdWidget <EOL> class SalmonellaMixin ( object ) : <EOL> salmonella_fields = ( ) <EOL> def formfield_for_foreignkey ( self , db_field , request = None , ** kwargs ) : <EOL> if db_field . name in self . salmonella_fields : <EOL> try : <EOL> kwargs [ '<STR_LIT>' ] = SalmonellaIdWidget ( db_field . rel ) <EOL> except TypeError : <EOL> kwargs [ '<STR_LIT>' ] = SalmonellaIdWidget ( db_field . rel , self . admin_site ) <EOL> return db_field . formfield ( ** kwargs ) <EOL> return super ( SalmonellaMixin , self ) . formfield_for_foreignkey ( db_field , <EOL> request , <EOL> ** kwargs ) <EOL> def formfield_for_manytomany ( self , db_field , request = None , ** kwargs ) : <EOL> if db_field . name in self . salmonella_fields : <EOL> try : <EOL> kwargs [ '<STR_LIT>' ] = SalmonellaMultiIdWidget ( db_field . rel ) <EOL> except TypeError : <EOL> kwargs [ '<STR_LIT>' ] = SalmonellaMultiIdWidget ( db_field . rel , self . admin_site ) <EOL> kwargs [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> return db_field . formfield ( ** kwargs ) <EOL> return super ( SalmonellaMixin , self ) . formfield_for_manytomany ( db_field , <EOL> request , <EOL> ** kwargs ) </s>
