Created
January 6, 2011 17:38
-
-
Save BlackFoks/768244 to your computer and use it in GitHub Desktop.
Пример получения роута до страницы с учетом иерархии
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PagesControler(Controller): | |
| # Some code here | |
| def get_route(self, page_entity): | |
| if page_entity.parent: | |
| # return page1/page2/page3 | |
| return "/".join([page_entity.parent.get_route(), page_entity.slug]) | |
| else: | |
| # return page1 | |
| return page_entity.slug | |
| # Some code here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment