feat(pages.py): add gitea login redirect url property for handling links to repo

This commit is contained in:
2026-05-05 12:44:37 +02:00
parent a9d7aef6dd
commit 36c14ab939

View File

@@ -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"):