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