From 4503fab834b5939b385ce0365f24825f0e311646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=85=E7=9D=BF=E6=9B=BC?= Date: Fri, 25 Oct 2024 11:28:32 +0800 Subject: [PATCH] fix reference issues. --- djangocms_references/monkeypatch/admin.py | 10 ++++++---- .../templates/djangocms_references/references.html | 5 +++++ .../djangocms_references/references_icon.html | 4 +++- .../admin/action_buttons/show_references.html | 6 ++++-- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/djangocms_references/monkeypatch/admin.py b/djangocms_references/monkeypatch/admin.py index fe9684f..d1a22f9 100644 --- a/djangocms_references/monkeypatch/admin.py +++ b/djangocms_references/monkeypatch/admin.py @@ -8,9 +8,9 @@ from djangocms_references.compat import DJANGO_CMS_4_1 -def generate_get_references_link(content_grouper): +def generate_get_references_link(content_grouper=None): def _get_references_link(self, obj, request): - obj_grouper = getattr(obj, content_grouper) + obj_grouper = obj if not content_grouper else getattr(obj, content_grouper) _obj_grouper_meta = obj_grouper._meta content_type = ContentType.objects.get( app_label=_obj_grouper_meta.app_label, @@ -48,8 +48,10 @@ def inner(self, *args, **kwargs): SnippetOriginalAdmin.SnippetAdmin.get_list_actions ) else: - AliasOriginalAdmin.AliasAdmin._get_references_link = generate_get_references_link('alias') + AliasOriginalAdmin.AliasAdmin._get_references_link = generate_get_references_link() AliasOriginalAdmin.AliasAdmin.get_actions_list = _get_actions_list(AliasOriginalAdmin.AliasAdmin.get_actions_list) SnippetOriginalAdmin.SnippetAdmin._get_references_link = generate_get_references_link('snippet_grouper') - SnippetOriginalAdmin.SnippetAdmin.get_actions_list = _get_actions_list(SnippetOriginalAdmin.SnippetAdmin.get_actions_list) + SnippetOriginalAdmin.SnippetAdmin.get_actions_list = _get_actions_list( + SnippetOriginalAdmin.SnippetAdmin.get_actions_list + ) diff --git a/djangocms_references/templates/djangocms_references/references.html b/djangocms_references/templates/djangocms_references/references.html index 74e8e2c..b74468a 100644 --- a/djangocms_references/templates/djangocms_references/references.html +++ b/djangocms_references/templates/djangocms_references/references.html @@ -4,6 +4,11 @@ {% block extrastyle %} {{ block.super }} + {% endblock %} {% block extrahead %} diff --git a/djangocms_references/templates/djangocms_references/references_icon.html b/djangocms_references/templates/djangocms_references/references_icon.html index ae2649f..ae784e3 100644 --- a/djangocms_references/templates/djangocms_references/references_icon.html +++ b/djangocms_references/templates/djangocms_references/references_icon.html @@ -1,2 +1,4 @@ {% load static i18n %} - + + + diff --git a/djangocms_references/templates/djangocms_versioning_filer/admin/action_buttons/show_references.html b/djangocms_references/templates/djangocms_versioning_filer/admin/action_buttons/show_references.html index 38a1d60..398f4dd 100644 --- a/djangocms_references/templates/djangocms_versioning_filer/admin/action_buttons/show_references.html +++ b/djangocms_references/templates/djangocms_versioning_filer/admin/action_buttons/show_references.html @@ -1,5 +1,7 @@ {% load i18n djangocms_references_tags %} {% get_versioning_filer_references_url file as references_url %} - \ No newline at end of file + + + +