def delete_view(self, request, object_id, extra_context=None):
        parent_folder = None
        try:
            obj = self.get_queryset(request).get(pk=unquote(object_id))
            parent_folder = obj.folder
        except self.model.DoesNotExist:
            obj = None

        r = super(FileAdmin, self).delete_view(
            request=request, object_id=object_id,
            extra_context=extra_context)

        url = r.get("Location", None)

        # Check against filer_file_changelist as file deletion is always made by
        # the base class
        if (url in ["../../../../", "../../"] or
                url == reverse("admin:media_file_changelist") or
                url == reverse("admin:media_image_changelist")):
            if parent_folder:
                url = reverse('admin:filer-directory_listing',
                              kwargs={'folder_id': parent_folder.id})
            else:
                url = reverse('admin:filer-directory_listing-unfiled_images')
            url = "%s%s%s" % (url, popup_param(request),
                              selectfolder_param(request, "&"))
            return HttpResponseRedirect(url)
        return r
Overrides the default to enable redirecting to the directory view after
dataset/ETHPy150Open django-leonardo/django-leonardo/leonardo/module/media/admin/file/admin.py/FileAdmin.delete_view