#NEWLINE# def handle_delete( sender , path = None , **kwargs ) : #NEWLINE# #INDENT# url = os . path . join ( get_relative_media_url ( ) , DIRECTORY , path , kwargs [ 'filename' ] ) #NEWLINE# url_qs = Url . objects . filter ( url = url ) . filter ( status = True ) #NEWLINE# count = url_qs . count ( ) #NEWLINE# if count : #NEWLINE# #INDENT# url_qs . update ( status = False , message = 'Missing Document' ) #NEWLINE# msg = ( 'Warning. Deleting %s has caused %s link%s to break. Please use the Link Manager to fix them' % ( url , count , ( ( ( count > 1 ) and 's' ) or '' ) ) ) #NEWLINE# messages . info ( sender , msg )