docs: def redirect_staff_to_draft_view_on_404(request, response):
          """
          When a request fails with a 404, redirect to a (potential) draft
          version of the resource if the user is a staff member permitted to view
          drafts.
          """
          if (response.status_code == 404
                  # No point redirecting if we already have a draft request
                  and not PublishingMiddleware.is_draft_request(request)
                  # Don't mess with admin requests at all
                  and not PublishingMiddleware.is_admin_request(request)
                  # Don't mess with API requests at all
                  and not PublishingMiddleware.is_api_request(request)
                  # Can user view draft content if we add the 'preview' param
                  and PublishingMiddleware.is_staff_user(request)):
              # TODO Is there a sane way to check for draft version of resource
              # at this URL path, without just redirecting the user to it?
              return HttpResponseRedirect(get_draft_url(request.get_full_path()))
          return response