-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Allow "View on Site" for objects not on the current site #479
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
2846080
712f59c
311f829
3cfd0c0
1a4f320
3ec8f52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1101,9 +1101,14 @@ def publish_view(self, request, object_id): | |
| self.message_user(request, _("Version published")) | ||
|
|
||
| # Redirect to published? | ||
| if conf.ON_PUBLISH_REDIRECT == "published": | ||
| if hasattr(version.content, "get_absolute_url"): | ||
| requested_redirect = requested_redirect or version.content.get_absolute_url() | ||
| if not requested_redirect and conf.ON_PUBLISH_REDIRECT == "published": | ||
| if hasattr(version.content, "get_full_url"): | ||
| full_url = version.content.get_full_url() | ||
| if full_url: | ||
| # Can't resolve full_url, redirect directly to it | ||
|
||
| return redirect(full_url) | ||
| elif hasattr(version.content, "get_absolute_url"): | ||
| requested_redirect = version.content.get_absolute_url() | ||
|
|
||
| return self._internal_redirect(requested_redirect, redirect_url) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -258,7 +258,9 @@ def _add_view_published_button(self): | |||||||||||||||||||
| if not published_version: | ||||||||||||||||||||
| return | ||||||||||||||||||||
|
|
||||||||||||||||||||
| url = published_version.get_absolute_url() if hasattr(published_version, "get_absolute_url") else None | ||||||||||||||||||||
| url = published_version.get_full_url() if hasattr(published_version, "get_full_url") else None | ||||||||||||||||||||
| if not url and hasattr(published_version, "get_absolute_url"): | ||||||||||||||||||||
| url = published_version.get_absolute_url() | ||||||||||||||||||||
|
||||||||||||||||||||
| url = published_version.get_full_url() if hasattr(published_version, "get_full_url") else None | |
| if not url and hasattr(published_version, "get_absolute_url"): | |
| url = published_version.get_absolute_url() | |
| if hasattr(published_version, "get_full_url"): | |
| url = published_version.get_full_url() | |
| elif hasattr(published_version, "get_absolute_url"): | |
| url = published_version.get_absolute_url() | |
| else: | |
| url = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code-quality): Use named expression to simplify assignment and conditional (
use-named-expression)