#NEWLINE# def pre_init_mongodb_signal( sender , args , **kwargs ) : #NEWLINE# #INDENT# if sender . _meta . abstract : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# from django.conf import settings #NEWLINE# database = settings . DATABASES [ sender . objects . db ] #NEWLINE# if ( not ( 'elasticsearch' in database [ 'ENGINE' ] ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( ( not hasattr ( django , 'MODIFIED' ) ) and isinstance ( sender . _meta . pk , DJAutoField ) ) : #NEWLINE# #INDENT# pk = sender . _meta . pk #NEWLINE# setattr ( pk , 'to_python' , autofield_to_python ) #NEWLINE# setattr ( pk , 'get_prep_value' , autofield_get_prep_value )