From 5682b783b4b7b468c780e86ecc459223bd05561b Mon Sep 17 00:00:00 2001 From: Frederik De Bleser Date: Thu, 25 Sep 2008 15:46:20 +0200 Subject: [PATCH] Navigation is now configurable in settings. --- settings.py | 9 +++++++++ settings_local_example.py | 6 ++++++ templates/base.html | 10 +++------- util/context.py | 5 +++++ 4 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 util/context.py diff --git a/settings.py b/settings.py index 5e4e5b0..ce82d41 100644 --- a/settings.py +++ b/settings.py @@ -44,6 +44,14 @@ 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware', ) +TEMPLATE_CONTEXT_PROCESSORS = ( + 'django.core.context_processors.auth', + 'django.core.context_processors.debug', + 'django.core.context_processors.i18n', + 'django.core.context_processors.media', + 'util.context.primary_links_to_context', +) + ROOT_URLCONF = 'projecthub.urls' TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, 'templates'),) @@ -62,6 +70,7 @@ 'apps.weblog', 'apps.forum', 'apps.accounts', + 'util', 'dmigrations', ) diff --git a/settings_local_example.py b/settings_local_example.py index 5f5a6a6..ac91e30 100644 --- a/settings_local_example.py +++ b/settings_local_example.py @@ -9,3 +9,9 @@ DATABASE_HOST = '' DATABASE_PORT = '' +PRIMARY_LINKS = ( + ('Home', '/'), + ('Download', '/download/'), + ('Documentation', '/documentation/'), + ('Weblog', '/weblog/'), + ('Forum', '/forum/')) diff --git a/templates/base.html b/templates/base.html index cec0e12..946625e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -22,13 +22,9 @@ {% endif %}
diff --git a/util/context.py b/util/context.py new file mode 100644 index 0000000..bf17c14 --- /dev/null +++ b/util/context.py @@ -0,0 +1,5 @@ +from django.conf import settings + +def primary_links_to_context(request): + """Load navigation in the template""" + return {'PRIMARY_LINKS':settings.PRIMARY_LINKS} \ No newline at end of file