mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 21:18:16 -06:00
Remove is_embedded() HTMX utility
This commit is contained in:
parent
e799821032
commit
dd8d2e1718
@ -22,7 +22,6 @@ from utilities.error_handlers import handle_protectederror
|
||||
from utilities.exceptions import AbortRequest, AbortTransaction, PermissionsViolation
|
||||
from utilities.forms import BulkRenameForm, ConfirmationForm, restrict_form_fields
|
||||
from utilities.forms.bulk_import import BulkImportForm
|
||||
from utilities.htmx import is_embedded
|
||||
from utilities.permissions import get_permission_for_model
|
||||
from utilities.utils import get_viewname
|
||||
from utilities.views import GetReturnURLMixin
|
||||
@ -163,7 +162,7 @@ class ObjectListView(BaseMultiObjectView, ActionsMixin, TableMixin):
|
||||
|
||||
# If this is an HTMX request, return only the rendered table HTML
|
||||
if request.htmx:
|
||||
if is_embedded(request):
|
||||
if request.htmx.target != 'object_list':
|
||||
table.embedded = True
|
||||
# Hide selection checkboxes
|
||||
if 'pk' in table.base_columns:
|
||||
|
@ -1,16 +0,0 @@
|
||||
from urllib.parse import urlparse
|
||||
|
||||
__all__ = (
|
||||
'is_embedded',
|
||||
)
|
||||
|
||||
|
||||
def is_embedded(request):
|
||||
"""
|
||||
Returns True if the request indicates that it originates from a URL different from
|
||||
the path being requested.
|
||||
"""
|
||||
hx_current_url = request.headers.get('HX-Current-URL', None)
|
||||
if not hx_current_url:
|
||||
return False
|
||||
return request.path != urlparse(hx_current_url).path
|
Loading…
Reference in New Issue
Block a user