title: Insert new child menu items in existing menu
body: <p>I'm working on a project and I need to be able to programatically inject a number of application-model-based items into an existing CMS-based menu.  I've started to use the code found here to modify the menu: <a href="http://docs.django-cms.org/en/2.3.3/extending_cms/app_integration.html" rel="nofollow">http://docs.django-cms.org/en/2.3.3/extending_cms/app_integration.html</a>.</p>
  
  <p>EDIT: Much more detail</p>
  
  <p>My client would like me to attach application-model objects to the CMS menu so that they are children of an existing CMS page in the menu.  I currently have a total hack in place which requires me to make fake pages in the CMS that are children of the desired menu item, have the same name as the application-model objects, then, I've installed a Modifier like so:</p>
  
  <pre><code>class SportsMenuModifier(Modifier):
    def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb):
      if post_cut:
        return nodes
  
      for node in nodes:
        if node.title == "Baseball":
          node.url = "/sports/baseball"
        elif node.title == "Football":
          node.url = "/sports/Football"
        elif node.title == "Bowling":
          node.url = "/sports/bowling"
        elif node.title == "Golf":
          node.url = "/sports/golf"
  
      return nodes
  
  menu_pool.register_modifier(SportsMenuModifier)
  </code></pre>
  
  <p>There is so much wrong with this I don't know where to begin, but I'll use this non-exhaustive list to highlight some of the most basic issues:</p>
  
  <ul>
  <li>Requires the presence of "Fake" CMS pages</li>
  <li>Ridiculously dependent on the naming of the application sports objects and the fake pages</li>
  <li>Will
  not detect when the customer creates new sports objects</li>
  <li>Very confusing for everyone involved</li>
  </ul>
  
  <p>What I was hoping I could do was something like this (WILL NOT WORK):</p>
  
  <p>in models.py</p>
  
  <pre><code>from django.db import models
  from cms.models.pagemodel import Page
  
  class Sport(models.Model):
    name = models.CharField(...)
    parent = modes.ForeignKey(Page, ...)
    ...
  </code></pre>
  
  <p>in menu.py</p>
  
  <pre><code>class SportsMenu(Menu):
    def get_nodes(self, request):
      nodes = []
  
      for sport in Sports.objects.filter(...).order_by('order'):
        node = NavigationNode(
          _(sport.name),
          sport.get_absolute_url(),
          sport.pk,
          sport.parent.pk
        )
        nodes.append(node)
  
      return nodes
  
  menu_pool.register_menu(SportsMenu)
  </code></pre>
  
  <p>I'm not sure I can continue with this approach because:</p>
  
  <ol>
  <li><p>I don't know how to fetch the menu.namespace for a given Page</p></li>
  <li><p>Even when I hard-code the namespace to "CMSMenu" (I read somewhere this is what it is), this still does nothing that I can see.</p></li>
  </ol>
  
  <p>So, how do we attach application-model based objects as children to <strong>existing</strong> CMS-page-based menu items?</p>