Skip to content

Commit

Permalink
Fix: Only offer settings button if the admin change view exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed May 22, 2024
1 parent b898442 commit 8067ea3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions djangocms_versioning/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,13 +847,17 @@ def _get_settings_link(self, obj, request):
# If the content object is not registered for frontend editing no action should be present
# Also, the content object must be registered with the admin site
content_model = obj.versionable.content_model
if not is_editable_model(content_model) or not self.admin_site.is_registered(content_model):
if not is_editable_model(content_model):
return ""

settings_url = reverse(
f"admin:{content_model._meta.app_label}_{content_model._meta.model_name}_change",
args=(obj.content.pk,)
)
try:
settings_url = reverse(
f"admin:{content_model._meta.app_label}_{content_model._meta.model_name}_change",
args=(obj.content.pk,)
)
except Resolver404:
return ""

Check failure on line 860 in djangocms_versioning/admin.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W293)

djangocms_versioning/admin.py:860:1: W293 Blank line contains whitespace

Check failure on line 860 in djangocms_versioning/admin.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (W293)

djangocms_versioning/admin.py:860:1: W293 Blank line contains whitespace
return self.admin_action_button(
settings_url,
icon="settings",
Expand Down

0 comments on commit 8067ea3

Please sign in to comment.