Skip to content

Commit

Permalink
Merge branch 'master' into release/2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun authored Nov 20, 2024
2 parents f87707b + 3ba3433 commit 9eb69bd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions djangocms_alias/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ def objects_using(self):
plugins = self.cms_plugins.select_related("placeholder").prefetch_related("placeholder__source")
for plugin in plugins:
obj = plugin.placeholder.source

# Skip plugins that have no placeholder source e.g clipboard
if obj is None:
continue

obj_class_name = obj.__class__.__name__
if obj_class_name.endswith("Content"):
attr_name = obj_class_name.replace("Content", "").lower()
Expand Down
21 changes: 21 additions & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,3 +1580,24 @@ def test_view_multilanguage(self):
self.assertNotContains(list_response, alias_content_de.name)
self.assertNotContains(detail_response, en_plugin.body)
self.assertNotContains(list_response, alias.name)

def test_usage_view_if_alias_is_saved_to_clipboard(self):
"""
The usage view should ignore the clipboard entry
"""

alias = self._create_alias()
placeholder = Placeholder.objects.create(slot="clipboard")
add_plugin(placeholder, "Alias", language="en", alias=alias)

with self.login_user_context(self.superuser):
response = self.client.get(
admin_reverse(
USAGE_ALIAS_URL_NAME,
args=[alias.pk],
),
)

self.assertEqual(response.status_code, 200)
# Check that the alias is displayed in the response content
self.assertContains(response, alias.name)

0 comments on commit 9eb69bd

Please sign in to comment.