Skip to content

Commit

Permalink
ci: auto fixes from pre-commit hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 12, 2024
1 parent def2d56 commit a026a8a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 18 deletions.
6 changes: 3 additions & 3 deletions djangocms_alias/cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def get_extra_plugin_menu_items(cls, request, plugin):
if alias_content:
plugin_menu_items.append(
PluginMenuItem(
_('Edit Alias'),
_("Edit Alias"),
get_object_edit_url(alias_content),
action='',
attributes={'cms-icon': 'alias'},
action="",
attributes={"cms-icon": "alias"},
),
)

Expand Down
4 changes: 3 additions & 1 deletion djangocms_alias/cms_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ def override_language_switcher(self):
)
if alias_content:
url = get_object_edit_url(alias_content, language=code)
language_menu.add_link_item(name, url=url, active=self.current_lang == code)
language_menu.add_link_item(
name, url=url, active=self.current_lang == code
)

def change_language_menu(self):
if self.toolbar.edit_mode_active and isinstance(self.toolbar.obj, AliasContent):
Expand Down
6 changes: 3 additions & 3 deletions djangocms_alias/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ def save(self):
name=self.cleaned_data.get("name"),
language=self.cleaned_data.get("language"),
)
if self.cleaned_data.get('replace'):
placeholder = self.cleaned_data.get('placeholder')
plugin = self.cleaned_data.get('plugin')
if self.cleaned_data.get("replace"):
placeholder = self.cleaned_data.get("placeholder")
plugin = self.cleaned_data.get("plugin")
source_plugins = None
else:
placeholder, plugin = None, None
Expand Down
12 changes: 9 additions & 3 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,15 @@ def test_aliascontent_list_view(self):
self.assertNotContains(response, "Published")
self.assertNotContains(response, "Draft")

aliascontent1_url = get_object_preview_url(alias1.get_content(show_draft_content=True))
aliascontent2_url = get_object_preview_url(alias2.get_content(show_draft_content=True))
aliascontent3_url = get_object_preview_url(alias3.get_content(show_draft_content=True))
aliascontent1_url = get_object_preview_url(
alias1.get_content(show_draft_content=True)
)
aliascontent2_url = get_object_preview_url(
alias2.get_content(show_draft_content=True)
)
aliascontent3_url = get_object_preview_url(
alias3.get_content(show_draft_content=True)
)

# when versioning is not enabled, the django admin change form
# is used which used links to the aliascontent_change view
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cms_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def test_extra_plugin_items_for_alias_plugins(self):

self.assertEqual(len(extra_items), 2)
first, second = extra_items
self.assertEqual(first.name, 'Edit Alias')
self.assertEqual(first.name, "Edit Alias")
self.assertEqual(first.url, get_object_edit_url(alias.get_content()))
self.assertEqual(first.action, '')
self.assertEqual(first.action, "")

self.assertEqual(second.name, "Detach Alias")
self.assertEqual(second.action, "modal")
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_extra_plugin_items_with_versioning_checks(self):
self.assertEqual(len(extra_items), 1)
first = extra_items[0]
# We cannot detach alias on undraft page
self.assertEqual(first.name, 'Edit Alias')
self.assertEqual(first.name, "Edit Alias")
self.assertEqual(first.url, get_object_edit_url(alias.get_content()))

def test_rendering_plugin_on_page(self):
Expand Down
20 changes: 15 additions & 5 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,9 @@ def test_view_multilanguage(self):
if is_versioning_enabled():
# we need to call get_absolute_url on the AliasContent object when versioning is enabled,
# otherwise we are taken to the version list url
detail_response = self.client.get(get_object_edit_url(alias.get_content(language="en")))
detail_response = self.client.get(
get_object_edit_url(alias.get_content(language="en"))
)
else:
detail_response = self.client.get(alias.get_absolute_url())
list_response = self.client.get(
Expand All @@ -1570,9 +1572,13 @@ def test_view_multilanguage(self):
if is_versioning_enabled():
# we need to call get_absolute_url on the AliasContent object when versioning is enabled,
# otherwise we are taken to the version list url
detail_response = self.client.get(get_object_edit_url(alias_content_de))
detail_response = self.client.get(
get_object_edit_url(alias_content_de)
)
else:
detail_response = self.client.get(get_object_edit_url(alias.get_content()))
detail_response = self.client.get(
get_object_edit_url(alias.get_content())
)
list_response = self.client.get(
admin_reverse(LIST_ALIAS_URL_NAME),
)
Expand All @@ -1588,9 +1594,13 @@ def test_view_multilanguage(self):
if is_versioning_enabled():
# we need to call get_absolute_url on the AliasContent object when versioning is enabled,
# otherwise we are taken to the version list url
detail_response = self.client.get(get_object_edit_url(alias_content_fr))
detail_response = self.client.get(
get_object_edit_url(alias_content_fr)
)
else:
detail_response = self.client.get(get_object_edit_url(alias.get_content()))
detail_response = self.client.get(
get_object_edit_url(alias.get_content())
)
list_response = self.client.get(
admin_reverse(LIST_ALIAS_URL_NAME), # noqa: E501
)
Expand Down

0 comments on commit a026a8a

Please sign in to comment.