@receiver(post_delete, sender=Project)
@receiver(post_delete, sender=SubProject)
def delete_object_dir(sender, instance, **kwargs):
 if (hasattr(instance, 'is_repo_link') and instance.is_repo_link):
  return
 project_path = instance.get_path()
 if os.path.exists(project_path):
  shutil.rmtree(project_path)

@ receiver ( post_delete , sender = Project ) @ receiver ( post_delete , sender = SubProject ) def delete_object_dir ( sender , instance , ** kwargs ) : if ( hasattr ( instance , 'is_repo_link' ) and instance . is_repo_link ) : return project_path = instance . get_path ( ) if os . path . exists ( project_path ) : shutil . rmtree ( project_path )
handler to delete project directory on project deletion .