#NEWLINE# def get_one( self , get_params , _id , user = None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# item = self . model . objects . get ( id = _id ) #NEWLINE# #UNINDENT# except self . model . DoesNotExist : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'error' : 'No result matches id: {}' . format ( _id ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( self . user_field_to_restrict_by and ( not self . filter_by_user ( self . get_queryset ( get_params ) , user ) . filter ( pk = _id ) . exists ( ) ) ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'error' : 'You do not have access to this data' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# return self . serialize ( item )