#NEWLINE# def decode_django( self , data ) : #NEWLINE# #INDENT# from django.contrib.contenttypes.models import ContentType #NEWLINE# if ( data [ '_type' ] == 'django' ) : #NEWLINE# #INDENT# model = ContentType . objects . get ( app_label = data [ '_app' ] , model = self [ '_model' ] ) #NEWLINE# return ModelLazyObject ( model . model_class ( ) , data [ 'pk' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( data [ '_type' ] == 'emb' ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# model = ContentType . objects . get ( app_label = data [ '_app' ] , model = data [ '_model' ] ) . model_class ( ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# module = import_module ( data [ '_app' ] ) #NEWLINE# model = getattr ( module , data [ '_model' ] ) #NEWLINE# #UNINDENT# del data [ '_type' ] #NEWLINE# del data [ '_app' ] #NEWLINE# del data [ '_model' ] #NEWLINE# data . pop ( '_id' , None ) #NEWLINE# values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( k , v ) in data . items ( ) : #NEWLINE# #INDENT# values [ str ( k ) ] = self . json_to_python ( v ) #NEWLINE# #UNINDENT# return model ( ** values )