feat(pages.py): add gitea login redirect url property for handling links to repo
This commit is contained in:
@@ -214,6 +214,14 @@ class ModuleLessonPage(Page):
|
||||
help_text="URL of the Gitea repository for this lesson (auto-generated if 'create_gitea_repo' is enabled)",
|
||||
)
|
||||
|
||||
@property
|
||||
def gitea_login_redirect_url(self):
|
||||
gitea_root_url = getattr(settings, "GITEA_ROOT_URL")
|
||||
if self.gitea_repo_url and gitea_root_url:
|
||||
uri = str(self.gitea_repo_url).replace(gitea_root_url, "")
|
||||
return f"{gitea_root_url}/user/login?redirect_to={uri}"
|
||||
return None
|
||||
|
||||
@property
|
||||
def module(self):
|
||||
if hasattr(self, "get_parent"):
|
||||
|
||||
Reference in New Issue
Block a user