#NEWLINE# def delete_view( self , request , object_id , extra_context = None ) : #NEWLINE# #INDENT# '\n        Overrides the default to enable redirecting to the directory view after\n        deletion of a image.\n\n        we need to fetch the object and find out who the parent is\n        before super, because super will delete the object and make it\n        impossible to find out the parent folder to redirect to.\n        ' #NEWLINE# parent_folder = None #NEWLINE# try : #NEWLINE# #INDENT# obj = self . get_queryset ( request ) . get ( pk = unquote ( object_id ) ) #NEWLINE# parent_folder = obj . folder #NEWLINE# #UNINDENT# except self . model . DoesNotExist : #NEWLINE# #INDENT# obj = None #NEWLINE# #UNINDENT# r = super ( FileAdmin , self ) . delete_view ( request = request , object_id = object_id , extra_context = extra_context ) #NEWLINE# url = r . get ( 'Location' , None ) #NEWLINE# if ( ( url in [ '../../../../' , '../../' ] ) or ( url == reverse ( 'admin:media_file_changelist' ) ) or ( url == reverse ( 'admin:media_image_changelist' ) ) ) : #NEWLINE# #INDENT# if parent_folder : #NEWLINE# #INDENT# url = reverse ( 'admin:filer-directory_listing' , kwargs = { #NEWLINE# #INDENT# 'folder_id' : parent_folder . id , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# url = reverse ( 'admin:filer-directory_listing-unfiled_images' ) #NEWLINE# #UNINDENT# url = ( '%s%s%s' % ( url , popup_param ( request ) , selectfolder_param ( request , '&' ) ) ) #NEWLINE# return HttpResponseRedirect ( url ) #NEWLINE# #UNINDENT# return r