#NEWLINE# def formfield( self , **kwargs ) : #NEWLINE# #INDENT# db = kwargs . pop ( 'using' , None ) #NEWLINE# defaults = { #NEWLINE# #INDENT# 'form_class' : forms . ModelMultipleChoiceField , #NEWLINE# 'queryset' : self . remote_field . model . _default_manager . using ( db ) , #NEWLINE# #UNINDENT# } #NEWLINE# defaults . update ( kwargs ) #NEWLINE# if ( defaults . get ( 'initial' ) is not None ) : #NEWLINE# #INDENT# initial = defaults [ 'initial' ] #NEWLINE# if callable ( initial ) : #NEWLINE# #INDENT# initial = initial ( ) #NEWLINE# #UNINDENT# defaults [ 'initial' ] = [ i . _get_pk_val ( ) for i in initial ] #NEWLINE# #UNINDENT# return super ( ManyToManyField , self ) . formfield ( ** db )