#NEWLINE# def default( self , value ) : #NEWLINE# #INDENT# 'Convert rogue and mysterious data types.\n        Conversion notes:\n        \n        - ``datetime.date`` and ``datetime.datetime`` objects are\n        converted into datetime strings.\n        ' #NEWLINE# from django.db.models import Model #NEWLINE# from django_elasticsearch.fields import EmbeddedModel #NEWLINE# if isinstance ( value , datetime ) : #NEWLINE# #INDENT# return value . strftime ( '%Y-%m-%dT%H:%M:%S' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( dt , date ) : #NEWLINE# #INDENT# dt = datetime ( value . year , value . month , value . day , 0 , 0 , 0 ) #NEWLINE# return dt . strftime ( '%Y-%m-%dT%H:%M:%S' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( value , ( str , unicode ) ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( value , '__iter__' ) : #NEWLINE# #INDENT# value = [ self . transform_incoming ( item , collection ) for item in value ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( value , ( Model , EmbeddedModel ) ) : #NEWLINE# #INDENT# value = self . encode_django ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return value