#NEWLINE# def delete( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# if ( not self . has_model ( ) ) : #NEWLINE# #INDENT# raise NotImplementedError #NEWLINE# #UNINDENT# if ( ( not args ) and ( not kwargs ) ) : #NEWLINE# #INDENT# return rc . BAD_REQUEST #NEWLINE# #UNINDENT# pkfield = self . model . _meta . pk . name #NEWLINE# try : #NEWLINE# #INDENT# if ( pkfield in kwargs ) : #NEWLINE# #INDENT# inst = self . model . objects . get ( pk = kwargs . get ( pkfield ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# inst = self . model . objects . get ( * args , ** kwargs ) #NEWLINE# #UNINDENT# return self . delete_instance ( request , inst ) #NEWLINE# #UNINDENT# except self . model . MultipleObjectsReturned : #NEWLINE# #INDENT# return rc . DUPLICATE_ENTRY #NEWLINE# #UNINDENT# except inst . model . DoesNotExist : #NEWLINE# #INDENT# return rc . NOT_HERE