I'm start using Django-MPTT app to get a tree-based approach on my Django-site pages.
For ex. I have pages with sub pages:
Trance:
- Vocal Trance(sub page)
- Hard Trance(sub page)
Breaks:
- Atmo Breaks(sub page)
- Progressive Breaks(sub page)
How can I get access to them from urls.py? What pattern will help? Do I need to store Full_path in model or it can be done via url pattern?
I assume you mean you want to do URLs like this:
If so, it's probably best to store the url fragment in your model. Something like:
Then add a URL pattern:
And in your view you can just fetch the right page:
Thank you for your attention to my problem. See,How I finally do it.
models.py
urls.py
views.py
The trick is in we have to check if the page really exists accessing to it via full_slug:
Otherwise, it could be wrong allowing to check only by slug.
There's also a django app that will do the work for you: django-mptt-urls