File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,11 @@ def objects_using(self):
133133 plugins = self .cms_plugins .select_related ("placeholder" ).prefetch_related ("placeholder__source" )
134134 for plugin in plugins :
135135 obj = plugin .placeholder .source
136+
137+ # Skip plugins that have no placeholder source e.g clipboard
138+ if obj is None :
139+ continue
140+
136141 obj_class_name = obj .__class__ .__name__
137142 if obj_class_name .endswith ("Content" ):
138143 attr_name = obj_class_name .replace ("Content" , "" ).lower ()
Original file line number Diff line number Diff line change @@ -1580,3 +1580,24 @@ def test_view_multilanguage(self):
15801580 self .assertNotContains (list_response , alias_content_de .name )
15811581 self .assertNotContains (detail_response , en_plugin .body )
15821582 self .assertNotContains (list_response , alias .name )
1583+
1584+ def test_usage_view_if_alias_is_saved_to_clipboard (self ):
1585+ """
1586+ The usage view should ignore the clipboard entry
1587+ """
1588+
1589+ alias = self ._create_alias ()
1590+ placeholder = Placeholder .objects .create (slot = "clipboard" )
1591+ add_plugin (placeholder , "Alias" , language = "en" , alias = alias )
1592+
1593+ with self .login_user_context (self .superuser ):
1594+ response = self .client .get (
1595+ admin_reverse (
1596+ USAGE_ALIAS_URL_NAME ,
1597+ args = [alias .pk ],
1598+ ),
1599+ )
1600+
1601+ self .assertEqual (response .status_code , 200 )
1602+ # Check that the alias is displayed in the response content
1603+ self .assertContains (response , alias .name )
You can’t perform that action at this time.
0 commit comments