#NEWLINE# def formfield_for_foreignkey( self , db_field , request = None , **kwargs ) : #NEWLINE# #INDENT# '\n        Get a form Field for a ForeignKey.\n        ' #NEWLINE# db = kwargs . get ( 'using' ) #NEWLINE# if ( db_field . name in self . raw_id_fields ) : #NEWLINE# #INDENT# kwargs [ 'widget' ] = widgets . ForeignKeyRawIdWidget ( db_field . rel , self . admin_site , using = db ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( db_field . name in queryset . radio_fields ) : #NEWLINE# #INDENT# kwargs [ 'widget' ] = widgets . AdminRadioSelect ( attrs = { #NEWLINE# #INDENT# 'class' : get_ul_class ( self . radio_fields [ db_field . name ] ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# kwargs [ 'empty_label' ] = ( _ ( 'None' ) if db_field . blank else None ) #NEWLINE# #UNINDENT# #UNINDENT# if ( not ( 'queryset' in kwargs ) ) : #NEWLINE# #INDENT# queryset = self . get_field_queryset ( db , db_field , request ) #NEWLINE# if ( queryset is not None ) : #NEWLINE# #INDENT# kwargs [ 'queryset' ] = queryset #NEWLINE# #UNINDENT# #UNINDENT# return db_field . formfield ( ** kwargs )