Skip to content

Instantly share code, notes, and snippets.

@BlackFoks
Created January 6, 2011 17:38
Show Gist options
  • Select an option

  • Save BlackFoks/768244 to your computer and use it in GitHub Desktop.

Select an option

Save BlackFoks/768244 to your computer and use it in GitHub Desktop.
Пример получения роута до страницы с учетом иерархии
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