Skip to content

Commit 1b285ca

Browse files
committed
Fix #88: Move the django-js-asset import into the function so that the admin module is importable without it
1 parent 2f84bf3 commit 1b285ca

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Change log
44
Next version
55
~~~~~~~~~~~~
66

7+
- Made the new ``tree_queries.admin`` module importable when
8+
``django-js-asset`` isn't installed so that ``compilemessages`` and other
9+
tools automatically importing this module are allowed to work.
10+
11+
712
0.21 (2025-09-16)
813
~~~~~~~~~~~~~~~~~
914

tree_queries/admin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from django.urls import path
1111
from django.utils.html import format_html, format_html_join, mark_safe
1212
from django.utils.translation import gettext_lazy as _
13-
from js_asset.js import JS
1413

1514

1615
__all__ = (
@@ -61,6 +60,8 @@ class NodeAdmin(TreeAdmin):
6160

6261
@csrf_protect_m
6362
def changelist_view(self, request, **kwargs):
63+
from js_asset.js import JS # noqa: PLC0415
64+
6465
response = super().changelist_view(request, **kwargs)
6566
if not hasattr(response, "context_data"):
6667
return response

0 commit comments

Comments
 (0)