~loco-django-dev/loco-django/trunk

« back to all changes in this revision

Viewing changes to locodjango/navigation/context_processors.py

  • Committer: NerdyNick
  • Date: 2007-10-26 04:52:01 UTC
  • Revision ID: nerdynick@gmail.com-20071026045201-4hrnxmnpddf46s63
Improved the Navigation system
        Now supports categories
        PageCategory 1 is the default menu system
        The first page in the default menu is the default page for the website
        A RequestContext variable has been added containing a dictionary of all categories and there pages
                Check locodjango.navigation.views.siteMenu for an example of how to push it into your template
                Check /template/default/sitemenu.htm for example usage of the links dictionary in a template
                Note: You will need to follow the same render_to_string shortcut for all views in order to keep you navigation on all pages
OpenID support has been started
Default template media has been included into the /template/default/media folder.
        A Symbolic link or apache virtual directory will need to be added to your apache root directory for the site

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from locodjango.navigation.models import PageCategory
 
2
 
 
3
def navigation(request):
 
4
    """
 
5
    Handles inserting links into the RequestContext
 
6
    """
 
7
    links = {}
 
8
    for category in PageCategory.objects.all():
 
9
        links[category.id] = {
 
10
            'name': category.name,
 
11
            'pages': {}
 
12
        }
 
13
        for page in category.page_set.all():
 
14
            links[category.id]['pages'].update({page.id:{'name':page.name, 'url':page.GetURL()}})
 
15
    return {'links':links}
 
 
b'\\ No newline at end of file'