diff --git a/CHANGELOG.md b/CHANGELOG.md index b632329a69..1e7a335321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Add Slider plugin +### Fixed + +- Ugrade to djangocms-link 5 + ## [2.32.0] - 2024-11-27 ### Changed diff --git a/pyproject.toml b/pyproject.toml index 3cb91033b5..f78f61c81a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "Django<5", "djangocms-file", "djangocms-googlemap", - "djangocms-link<5", + "djangocms-link>=5.0.0,<6", "djangocms-picture", "djangocms-text-ckeditor", "djangocms-video", diff --git a/renovate.json b/renovate.json index acb01a665d..0a4fd10a90 100644 --- a/renovate.json +++ b/renovate.json @@ -31,8 +31,7 @@ "matchPackageNames": [ "Django", "django-cms", - "elasticsearch", - "djangocms-link" + "elasticsearch" ] } ] diff --git a/src/richie/apps/demo/defaults.py b/src/richie/apps/demo/defaults.py index bddb630244..bc1930c59c 100644 --- a/src/richie/apps/demo/defaults.py +++ b/src/richie/apps/demo/defaults.py @@ -373,47 +373,57 @@ FOOTER_CONTENT = { "en": [ - {"name": "About", "internal_link": "annex__about"}, - {"name": "Sitemap", "internal_link": "annex__sitemap"}, - {"name": "Style guide", "external_link": "/styleguide/"}, + {"name": "About", "link": {"internal_link": "annex__about"}}, + {"name": "Sitemap", "link": {"internal_link": "annex__sitemap"}}, + {"name": "Style guide", "link": {"external_link": "/styleguide/"}}, { "title": "Richie community", "items": [ - {"name": "Website", "external_link": "https://richie.education"}, + { + "name": "Website", + "link": {"external_link": "https://richie.education"}, + }, { "name": "Github", - "external_link": "https://github.com/openfun/richie", + "link": {"external_link": "https://github.com/openfun/richie"}, }, { "name": "Site factory", - "external_link": "https://github.com/openfun/richie-site-factory", + "link": { + "external_link": "https://github.com/openfun/richie-site-factory" + }, }, { "name": "Example site", - "external_link": "https://www.fun-campus.fr", + "link": {"external_link": "https://www.fun-campus.fr"}, }, ], }, ], "fr": [ - {"name": "A propos", "internal_link": "annex__about"}, - {"name": "Plan du site", "internal_link": "annex__sitemap"}, - {"name": "Style guide", "external_link": "/styleguide/"}, + {"name": "A propos", "link": {"internal_link": "annex__about"}}, + {"name": "Plan du site", "link": {"internal_link": "annex__sitemap"}}, + {"name": "Style guide", "link": {"external_link": "/styleguide/"}}, { "title": "Communauté Richie", "items": [ - {"name": "Site web", "external_link": "https://richie.education"}, + { + "name": "Site web", + "link": {"external_link": "https://richie.education"}, + }, { "name": "Github", - "external_link": "https://github.com/openfun/richie", + "link": {"external_link": "https://github.com/openfun/richie"}, }, { "name": "Usine à sites", - "external_link": "https://github.com/openfun/richie-site-factory", + "link": { + "external_link": "https://github.com/openfun/richie-site-factory" + }, }, { "name": "Site exemple", - "external_link": "https://www.fun-campus.fr", + "link": {"external_link": "https://www.fun-campus.fr"}, }, ], }, diff --git a/src/richie/apps/demo/management/commands/create_demo_site.py b/src/richie/apps/demo/management/commands/create_demo_site.py index dba156ebc8..c55e28cd13 100755 --- a/src/richie/apps/demo/management/commands/create_demo_site.py +++ b/src/richie/apps/demo/management/commands/create_demo_site.py @@ -81,6 +81,9 @@ def create_demo_site(): # Create pages as described in PAGES_INFOS pages_created = recursive_page_creation(site, defaults.PAGES_INFO) + def get_internal_link(page): + return f"cms.page:{page.id}" + # Create the footer links def create_footer_link(**link_info): """ @@ -89,9 +92,10 @@ def create_footer_link(**link_info): Links can be nested into a NestedItemPlugin, in this case link_info contains a target key. """ - if "internal_link" in link_info: + if "internal_link" in link_info["link"]: link_info = link_info.copy() - link_info["internal_link"] = pages_created[link_info["internal_link"]] + link_page = pages_created[link_info["link"]["internal_link"]] + link_info["link"] = {"internal_link": get_internal_link(link_page)} add_plugin(plugin_type="LinkPlugin", **link_info) footer_static_ph = StaticPlaceholder.objects.get_or_create(code="footer")[0] @@ -486,7 +490,7 @@ def create_footer_link(**link_info): target=courses_section, name=content["courses_button_title"], template=content["button_template_name"], - internal_link=pages_created["courses"], + link={"internal_link": get_internal_link(pages_created["courses"])}, ) # Add highlighted blogposts @@ -512,7 +516,7 @@ def create_footer_link(**link_info): target=blogposts_section, name=content["blogposts_button_title"], template=content["button_template_name"], - internal_link=pages_created["blogposts"], + link={"internal_link": get_internal_link(pages_created["blogposts"])}, ) # Add highlighted programs @@ -538,7 +542,7 @@ def create_footer_link(**link_info): target=programs_section, name=content["programs_button_title"], template=content["button_template_name"], - internal_link=pages_created["programs"], + link={"internal_link": get_internal_link(pages_created["programs"])}, ) # Add highlighted organizations @@ -566,7 +570,7 @@ def create_footer_link(**link_info): target=organizations_section, name=content["organizations_button_title"], template=content["button_template_name"], - internal_link=pages_created["organizations"], + link={"internal_link": get_internal_link(pages_created["organizations"])}, ) # Add highlighted subjects @@ -592,7 +596,7 @@ def create_footer_link(**link_info): target=subjects_section, name=content["subjects_button_title"], template=content["button_template_name"], - internal_link=pages_created["categories"], + link={"internal_link": get_internal_link(pages_created["categories"])}, ) # Add highlighted persons @@ -618,7 +622,7 @@ def create_footer_link(**link_info): target=persons_section, name=content["persons_button_title"], template=content["button_template_name"], - internal_link=pages_created["persons"], + link={"internal_link": get_internal_link(pages_created["persons"])}, ) # Add Glimpse quotes with empty title @@ -756,7 +760,7 @@ def create_footer_link(**link_info): target=sample_section, name=content["section_sample_button_title"], template=content["button_template_name"], - internal_link=pages_created["home"], + link={"internal_link": get_internal_link(pages_created["home"])}, ) # Add a licence if licences: diff --git a/tests/plugins/section/test_templates_section_default.py b/tests/plugins/section/test_templates_section_default.py index 6372f9a9e6..9e1d9d318e 100644 --- a/tests/plugins/section/test_templates_section_default.py +++ b/tests/plugins/section/test_templates_section_default.py @@ -27,7 +27,7 @@ def test_templates_section_default_flat(self): placeholder, plugin_type="LinkPlugin", language="en", - external_link="http://www.example.com/1", + link={"external_link": "http://www.example.com/1"}, name="Example 1", target=parent, ) @@ -35,7 +35,7 @@ def test_templates_section_default_flat(self): placeholder, plugin_type="LinkPlugin", language="en", - external_link="http://www.example.com/2", + link={"external_link": "http://www.example.com/2"}, name="Example 2", target=parent, ) @@ -159,7 +159,7 @@ def test_templates_section_default_nested(self): placeholder, plugin_type="LinkPlugin", language="en", - external_link="http://www.example.com/1", + link={"external_link": "http://www.example.com/1"}, name="Example 1", target=parent, ) @@ -167,7 +167,7 @@ def test_templates_section_default_nested(self): placeholder, plugin_type="LinkPlugin", language="en", - external_link="http://www.example.com/2", + link={"external_link": "http://www.example.com/2"}, name="Example 2", target=parent, )