prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  PROTECTION_RULES: Custom Validator does not show error message on object deletion
  ### Deployment Type
  
  Self-hosted
  
  ### NetBox Version
  
  v4.0-beta1 (commit c7f6c206cf5068f890b89da9ca04d4d3583f5107)
  
  ### Python Version
  
  3.11
  
  ### Steps to Reproduce
  
  1. Create a custom validator with the following code:
  ```python
  from extras.validators import CustomValidator
  from utilities.exceptions import AbortRequest
  
  
  class IPAddressDeleteValidator(CustomValidator):
  
      def validate(self, instance, request):
          raise AbortRequest("Do not delete IP addresses!")
  ```
  and store as `/opt/netbox/validators/test.py`
  
  2. Add the custom validator as a protect rule for `IPAddress` objects:
  ```python
  PROTECTION_RULES = {
      "ipam.ipaddress": [
          "validators.test.IPAddressDeleteValidator",
      ]
  }
  ```
  3. Navigate to IPAM/IP Addresses
  4. Create an arbitrary IP address
  5. Click on "Delete" in the new address's detail view and confirm deletion
  
  ### Expected Behavior
  
  The IP address is not deleted, an error message is shown saying "Do not delete IP addresses!"
  
  ### Observed Behavior
  
  The IP address is not deleted, but there is no error message. 
  
  The error message is, however, displayed when one tries to delete an IP address using the bulk edit view:
  
  ![Untitled](https://github.com/netbox-community/netbox/assets/6815386/799c7aad-8d48-4b53-b776-dfd9582400b5)
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `netbox/utilities/htmx.py`
  Content:
  ```
  1 __all__ = (
  2     'htmx_partial',
  3 )
  4 
  5 PAGE_CONTAINER_ID = 'page-content'
  6 
  7 
  8 def htmx_partial(request):
  9     """
  10     Determines whether to render partial (versus complete) HTML content
  11     in response to an HTMX request, based on the target element.
  12     """
  13     return request.htmx and request.htmx.target and request.htmx.target != PAGE_CONTAINER_ID
  14
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/netbox/utilities/htmx.py b/netbox/utilities/htmx.py
  --- a/netbox/utilities/htmx.py
  +++ b/netbox/utilities/htmx.py
  @@ -2,12 +2,10 @@
       'htmx_partial',
   )
   
  -PAGE_CONTAINER_ID = 'page-content'
  -
   
   def htmx_partial(request):
       """
       Determines whether to render partial (versus complete) HTML content
       in response to an HTMX request, based on the target element.
       """
  -    return request.htmx and request.htmx.target and request.htmx.target != PAGE_CONTAINER_ID
  +    return request.htmx and not request.htmx.boosted
  
verification_info: {"golden_diff": "diff --git a/netbox/utilities/htmx.py b/netbox/utilities/htmx.py\n--- a/netbox/utilities/htmx.py\n+++ b/netbox/utilities/htmx.py\n@@ -2,12 +2,10 @@\n     'htmx_partial',\n )\n \n-PAGE_CONTAINER_ID = 'page-content'\n-\n \n def htmx_partial(request):\n     \"\"\"\n     Determines whether to render partial (versus complete) HTML content\n     in response to an HTMX request, based on the target element.\n     \"\"\"\n-    return request.htmx and request.htmx.target and request.htmx.target != PAGE_CONTAINER_ID\n+    return request.htmx and not request.htmx.boosted\n", "issue": "PROTECTION_RULES: Custom Validator does not show error message on object deletion\n### Deployment Type\r\n\r\nSelf-hosted\r\n\r\n### NetBox Version\r\n\r\nv4.0-beta1 (commit c7f6c206cf5068f890b89da9ca04d4d3583f5107)\r\n\r\n### Python Version\r\n\r\n3.11\r\n\r\n### Steps to Reproduce\r\n\r\n1. Create a custom validator with the following code:\r\n```python\r\nfrom extras.validators import CustomValidator\r\nfrom utilities.exceptions import AbortRequest\r\n\r\n\r\nclass IPAddressDeleteValidator(CustomValidator):\r\n\r\n    def validate(self, instance, request):\r\n        raise AbortRequest(\"Do not delete IP addresses!\")\r\n```\r\nand store as `/opt/netbox/validators/test.py`\r\n\r\n2. Add the custom validator as a protect rule for `IPAddress` objects:\r\n```python\r\nPROTECTION_RULES = {\r\n    \"ipam.ipaddress\": [\r\n        \"validators.test.IPAddressDeleteValidator\",\r\n    ]\r\n}\r\n```\r\n3. Navigate to IPAM/IP Addresses\r\n4. Create an arbitrary IP address\r\n5. Click on \"Delete\" in the new address's detail view and confirm deletion\r\n\r\n### Expected Behavior\r\n\r\nThe IP address is not deleted, an error message is shown saying \"Do not delete IP addresses!\"\r\n\r\n### Observed Behavior\r\n\r\nThe IP address is not deleted, but there is no error message. \r\n\r\nThe error message is, however, displayed when one tries to delete an IP address using the bulk edit view:\r\n\r\n![Untitled](https://github.com/netbox-community/netbox/assets/6815386/799c7aad-8d48-4b53-b776-dfd9582400b5)\n", "before_files": [{"content": "__all__ = (\n    'htmx_partial',\n)\n\nPAGE_CONTAINER_ID = 'page-content'\n\n\ndef htmx_partial(request):\n    \"\"\"\n    Determines whether to render partial (versus complete) HTML content\n    in response to an HTMX request, based on the target element.\n    \"\"\"\n    return request.htmx and request.htmx.target and request.htmx.target != PAGE_CONTAINER_ID\n", "path": "netbox/utilities/htmx.py"}], "after_files": [{"content": "__all__ = (\n    'htmx_partial',\n)\n\n\ndef htmx_partial(request):\n    \"\"\"\n    Determines whether to render partial (versus complete) HTML content\n    in response to an HTMX request, based on the target element.\n    \"\"\"\n    return request.htmx and not request.htmx.boosted\n", "path": "netbox/utilities/htmx.py"}]}