diff --git a/netbox/netbox/tables/tables.py b/netbox/netbox/tables/tables.py
index 3a2e71084..741e7a2c1 100644
--- a/netbox/netbox/tables/tables.py
+++ b/netbox/netbox/tables/tables.py
@@ -4,6 +4,8 @@ from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import FieldDoesNotExist
from django.db.models.fields.related import RelatedField
+from django.urls import reverse
+from django.urls.exceptions import NoReverseMatch
from django.utils.safestring import mark_safe
from django.utils.translation import gettext as _
from django_tables2.data import TableQuerysetData
@@ -12,7 +14,7 @@ from extras.models import CustomField, CustomLink
from extras.choices import CustomFieldVisibilityChoices
from netbox.tables import columns
from utilities.paginator import EnhancedPaginator, get_paginate_count
-from utilities.utils import highlight_string, title
+from utilities.utils import get_viewname, highlight_string, title
__all__ = (
'BaseTable',
@@ -197,6 +199,15 @@ class NetBoxTable(BaseTable):
super().__init__(*args, extra_columns=extra_columns, **kwargs)
+ @property
+ def htmx_url(self):
+ viewname = get_viewname(self._meta.model, action='list')
+ try:
+ return reverse(viewname)
+ except NoReverseMatch:
+ pass
+ return ''
+
class SearchTable(tables.Table):
object_type = columns.ContentTypeColumn(
diff --git a/netbox/netbox/views/generic/bulk_views.py b/netbox/netbox/views/generic/bulk_views.py
index ab3e8f100..4953260d4 100644
--- a/netbox/netbox/views/generic/bulk_views.py
+++ b/netbox/netbox/views/generic/bulk_views.py
@@ -20,7 +20,7 @@ from utilities.choices import ImportFormatChoices
from utilities.error_handlers import handle_protectederror
from utilities.exceptions import AbortRequest, AbortTransaction, PermissionsViolation
from utilities.forms import BulkRenameForm, ConfirmationForm, ImportForm, restrict_form_fields
-from utilities.htmx import is_htmx
+from utilities.htmx import is_embedded, is_htmx
from utilities.permissions import get_permission_for_model
from utilities.views import GetReturnURLMixin
from .base import BaseMultiObjectView
@@ -161,6 +161,7 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
# If this is an HTMX request, return only the rendered table HTML
if is_htmx(request):
+ table.embedded = is_embedded(request)
return render(request, 'htmx/table.html', {
'table': table,
})
diff --git a/netbox/templates/dcim/connections_list.html b/netbox/templates/dcim/connections_list.html
index ef8bef828..0d67dcaf0 100644
--- a/netbox/templates/dcim/connections_list.html
+++ b/netbox/templates/dcim/connections_list.html
@@ -12,7 +12,7 @@
{% include 'inc/table_controls_htmx.html' %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/consoleports.html b/netbox/templates/dcim/device/consoleports.html
index 1f7cd037e..ccd12f61c 100644
--- a/netbox/templates/dcim/device/consoleports.html
+++ b/netbox/templates/dcim/device/consoleports.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/consoleserverports.html b/netbox/templates/dcim/device/consoleserverports.html
index 259a072b4..43396651d 100644
--- a/netbox/templates/dcim/device/consoleserverports.html
+++ b/netbox/templates/dcim/device/consoleserverports.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/devicebays.html b/netbox/templates/dcim/device/devicebays.html
index 5081b752b..9453b9a59 100644
--- a/netbox/templates/dcim/device/devicebays.html
+++ b/netbox/templates/dcim/device/devicebays.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/frontports.html b/netbox/templates/dcim/device/frontports.html
index 044337d00..dd0767d95 100644
--- a/netbox/templates/dcim/device/frontports.html
+++ b/netbox/templates/dcim/device/frontports.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/interfaces.html b/netbox/templates/dcim/device/interfaces.html
index 9de486a6f..c0e9a38b6 100644
--- a/netbox/templates/dcim/device/interfaces.html
+++ b/netbox/templates/dcim/device/interfaces.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/inventory.html b/netbox/templates/dcim/device/inventory.html
index 065fd92f6..9e11031ec 100644
--- a/netbox/templates/dcim/device/inventory.html
+++ b/netbox/templates/dcim/device/inventory.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/modulebays.html b/netbox/templates/dcim/device/modulebays.html
index 6358a3815..7f0aacf1f 100644
--- a/netbox/templates/dcim/device/modulebays.html
+++ b/netbox/templates/dcim/device/modulebays.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/poweroutlets.html b/netbox/templates/dcim/device/poweroutlets.html
index 35a9795d5..66b21b7af 100644
--- a/netbox/templates/dcim/device/poweroutlets.html
+++ b/netbox/templates/dcim/device/poweroutlets.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/powerports.html b/netbox/templates/dcim/device/powerports.html
index 69485c985..d9e1e121a 100644
--- a/netbox/templates/dcim/device/powerports.html
+++ b/netbox/templates/dcim/device/powerports.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/device/rearports.html b/netbox/templates/dcim/device/rearports.html
index 109e195dc..ce194cc78 100644
--- a/netbox/templates/dcim/device/rearports.html
+++ b/netbox/templates/dcim/device/rearports.html
@@ -10,7 +10,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/devicetype/component_templates.html b/netbox/templates/dcim/devicetype/component_templates.html
index 002a2044b..ca552a555 100644
--- a/netbox/templates/dcim/devicetype/component_templates.html
+++ b/netbox/templates/dcim/devicetype/component_templates.html
@@ -8,7 +8,7 @@
{% csrf_token %}
-
+
{% include 'htmx/table.html' %}