Skip to content

Commit 1e32052

Browse files
committed
fix: Plugin detection django CMS 5+
1 parent 40a8b7d commit 1e32052

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

djangocms_frontend/plugin_tag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def get_plugin_class(settings_string: str | type) -> type:
7777
def setup():
7878
allowed_plugin_types = tuple(get_plugin_class(cls) for cls in getattr(settings, "CMS_COMPONENT_PLUGINS", []))
7979

80-
for plugin in plugin_pool.get_all_plugins():
80+
for plugin in plugin_pool.get_all_plugins(root_plugin=False):
8181
if not issubclass(plugin, allowed_plugin_types):
8282
continue
8383
tag_name = plugin.__name__.lower()

tests/test_plugin_tag.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def test_tag_rendering_with_paramter(self):
2828
expected_result = """<div class="alert alert-secondary alert-dismissible" role="alert">
2929
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button><div>Alert
3030
</div></div>"""
31+
3132
result = template.render({"request": None})
3233

3334
self.assertInHTML(expected_result, result)
@@ -45,6 +46,8 @@ def test_simple_tag(self):
4546
self.assertInHTML(expected_result, result)
4647

4748
def test_complex_tags(self):
49+
from djangocms_frontend.plugin_tag import plugin_tag_pool
50+
4851
template = django_engine.from_string("""{% load frontend %}
4952
{% plugin "card" card_alignment="center" card_outline="info" card_text_color="primary" card_full_height=True %}
5053
{% plugin "cardinner" inner_type="card-header" text_alignment="start" %}
@@ -70,7 +73,12 @@ def test_complex_tags(self):
7073
<div class="list-group-item">A second item</div>
7174
<div class="list-group-item">A third item</div>
7275
</div>"""
76+
7377
result = template.render({"request": None})
78+
for item in plugin_tag_pool:
79+
print(item)
80+
self.assertIn("cardinner", plugin_tag_pool)
81+
7482
self.assertInHTML(expected_result, result)
7583

7684
def test_link_plugin(self):

0 commit comments

Comments
 (0)