divio/django-cms — pull request #1572 by evildmp (2013-01-04 14:04:36+00:00)
Title: Truncated menu

Code and docs for a new option on menu templatetags: truncate.

It's intended for ``{% show_menu %}``, and a better alternative to https://github.com/divio/django-cms/pull/1284. This way won't affect anyone who is using the menus as they, but allows users with large sites to speed menus up dramatically by adding the ``truncate`` argument to the template tag.

Basically, instead of building a menu out of every node for CMS pages, it's more selective, and eliminates ones that we won't be needing in the menu. This means that the expensive looping over nodes in the menu system (that could take 8 seconds on our site) is done over a much smaller set, fast enough to make cacheing unnecessary.

It won't be appropriate for every menu structure, but that's OK, because the default behaviour is unchanged.

I will follow this with tests, if this approach looks acceptable, but a lot need to be rewritten for this so I will wait for some feedback before tackling that.