Overrides the default to enable redirecting to the directory view after
        deletion of a folder.

        we need to fetch the object and find out who the parent is
        before super, because super will delete the object and make it
        impossible to find out the parent folder to redirect to.

        The delete_view breaks with polymorphic models if the cascade will
        try delete objects that are of different polymorphic types
        (AttributeError: 'File' object has no attribute 'file_ptr').
        The default implementation of the delete_view is hard to override
        without just copying the whole big thing. Since we've already done
        the overriding work on the delete_files_or_folders admin action, we
        can re-use that here instead.

def delete_view(self, request, object_id, extra_context=None):
        """
        Overrides the default to enable redirecting to the directory view after
        deletion of a folder.

        we need to fetch the object and find out who the parent is
        before super, because super will delete the object and make it
        impossible to find out the parent folder to redirect to.

        The delete_view breaks with polymorphic models if the cascade will
        try delete objects that are of different polymorphic types
        (AttributeError: 'File' object has no attribute 'file_ptr').
        The default implementation of the delete_view is hard to override
        without just copying the whole big thing. Since we've already done
        the overriding work on the delete_files_or_folders admin action, we
        can re-use that here instead.
        """
        try:
            obj = self.get_queryset(request).get(pk=unquote(object_id))
            parent_folder = obj.parent
        except self.model.DoesNotExist:
            parent_folder = None

        if request.POST:
            self.delete_files_or_folders(
                request,
                files_queryset=File.objects.none(),
                folders_queryset=self.get_queryset(request).filter(id=object_id)
            )
            if parent_folder:
                url = reverse('admin:filer-directory_listing',
                              kwargs={'folder_id': parent_folder.id})
            else:
                url = reverse('admin:filer-directory_listing-root')
            url = "{0}{1}".format(
                url,
                admin_url_params_encoded(request),
            )
            return HttpResponseRedirect(url)

        return self.delete_files_or_folders(
            request,
            files_queryset=File.objects.none(),
            folders_queryset=self.get_queryset(request).filter(id=object_id)
        )