8000 fix: Grouper admin raised AttributeError when used outside the admin views by fsbraun · Pull Request #8067 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

fix: Grouper admin raised AttributeError when used outside the admin views #8067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Nov 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Format Page.__str__ as "My title (/path/to/page/)"
  • Loading branch information
Github Release Action authored and marksweb committed Nov 6, 2024
commit 95e52c4cb289f1fe2f0d01c03ea8b879c019ebc7
8 changes: 5 additions & 3 deletions cms/models/pagemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,14 @@ def __init__(self, *args, **kwargs):
#: Might be larger than the page_content_cache

def __str__(self):
page_content = self.get_admin_content(get_language(), fallback=True)
page_content = self.get_content_obj(get_language(), fallback=True)
if page_content:
title = page_content.menu_title or page_content.title
else:
title = _("Empty")
return force_str(title)
title = _("No available title")
path = self.get_path(get_language(), fallback=True)
path = f" (/{path}/)" if path else ""
return force_str(title) + path

def __repr__(self):
display = f'<{self.__module__}.{self.__class__.__name__} id={self.pk} object at {hex(id(self))}>'
Expand Down
0