django-cms 2.2, django 1.3.1
I'm creating an app called gallery. Gallery has photos inside. (there are many galleries)
I have the following structure:
- cms_app.py - apphook for gallery (needed for gallery details (photos inside gallery) view)
- cms_plugins.py - plugin for galleries list
- menu.py - each gallery has its own page (photos inside galery), we generate menu here
- views.py - a view for gallery details (photos inside)
- urls.py - // url for apphook to attach for photos inside view,
name=gallery_details
URL structure:
/gallery-list/
- Page for list of galleries/gallery-list/1/
- Photos of pk=1 gallery/another-gallery-list/
- Another page for list of galleries/another-gallery-list/1/
- Photos of pk=1 gallery (the same as/gallery-list/1/
but different url)
django-cms page structure:
- Page
/gallery-list/
with apphook = gallery app hook + plugin for list of galleries - Page
/another-gallery-list/
with apphook = gallery app hook + plugin for list of galleries (same but different instances)
Menu:
- Galleries
- Gallery 1
- Another galleries
- Gallery 1
Problem: How do I generate menu for such galleries?
Currently I'm creating CMSAttachMenu and generating nodes (from model). How do I make urls? I'm trying to use reverse('gallery_details', args=[self.pk])
(get_absolute_url
method) but it gives me url: /galleries/<id>/
. What I want to get is /gallery-list/1/
and /another-gallery-list/1/
depending on page which has apphook attached.
Here is documentation that I'm using: http://docs.django-cms.org/en/2.2/extending_cms/app_integration.html#app-hooks
Help is much appreciated.