diff --git a/tildes/tildes/models/group/group_wiki_page.py b/tildes/tildes/models/group/group_wiki_page.py index 18d8998..a44d7c4 100644 --- a/tildes/tildes/models/group/group_wiki_page.py +++ b/tildes/tildes/models/group/group_wiki_page.py @@ -61,7 +61,7 @@ class GroupWikiPage(DatabaseModel): self.path = convert_to_url_slug(page_name) # prevent possible conflict with url for creating a new page - if self.path == "new_page": + if self.slug == "new_page": raise ValueError("Invalid page name") if self.file_path.exists(): @@ -99,6 +99,11 @@ class GroupWikiPage(DatabaseModel): """Return a relative path to the page's file.""" return Path(str(self.group.path), f"{self.path}.md") + @property + def slug(self) -> str: + """Return the page's slug, which is also its filename with no extension.""" + return self.file_path.stem + @property def history_url(self) -> str: """Return a url to the page's edit history."""