diff --git a/djangocms_frontend/contrib/link/models.py b/djangocms_frontend/contrib/link/models.py index fe1359ed..849cb7a5 100644 --- a/djangocms_frontend/contrib/link/models.py +++ b/djangocms_frontend/contrib/link/models.py @@ -17,12 +17,17 @@ def get_link(self): url_grouper = get_related_object(self.config, "url_grouper") if not url_grouper: return "" - url = url_grouper.get_content(show_draft_content=True) + # The next line is a workaround, since djangocms-url-manager does not provide a way of + # getting the current URL object. + from djangocms_url_manager.models import Url + url = Url._base_manager.filter(url_grouper=url_grouper).order_by("pk").last() + if not url: + return "" # simulate the call to the unauthorized CMSPlugin.page property cms_page = self.placeholder.page if self.placeholder_id else None # first, we check if the placeholder the plugin is attached to - # has a page. Thus the check "is not None": + # has a page. Thus, the check "is not None": if cms_page is not None: if getattr(cms_page, "node", None): cms_page_site_id = getattr(cms_page.node, "site_id", None) diff --git a/tests/test_plugin_tag.py b/tests/test_plugin_tag.py index 4417674e..8f33cc2c 100644 --- a/tests/test_plugin_tag.py +++ b/tests/test_plugin_tag.py @@ -1,5 +1,3 @@ -from unittest import skipIf - from cms import __version__ as cms_version from cms.test_utils.testcases import CMSTestCase from django.contrib.sites.shortcuts import get_current_site @@ -78,7 +76,6 @@ def test_complex_tags(self): self.assertInHTML(expected_result, result) - @skipIf(cms_version < "4", "djangocms-url-manager currently does not work with django CMS 4.1+") def test_link_plugin(self): if cms_version < "4": grouper = None