diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2010-12-27 17:01:06 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2010-12-27 17:01:06 +0100 |
commit | 305592b85c83a63c7bf14ce5ea63fbda29f1a81e (patch) | |
tree | 4e5c1b629c6108bca3d6e43e5e499cefca1fc2d0 | |
parent | d3050b0b9692cb2613ebf408498c1ad038eb2544 (diff) | |
download | Ishtar-305592b85c83a63c7bf14ce5ea63fbda29f1a81e.tar.bz2 Ishtar-305592b85c83a63c7bf14ce5ea63fbda29f1a81e.zip |
Add a context processor
-rw-r--r-- | ishtar/furnitures/context_processors.py | 27 | ||||
-rw-r--r-- | ishtar/furnitures/views.py | 9 | ||||
-rw-r--r-- | ishtar/settings.py.example | 9 | ||||
-rw-r--r-- | ishtar/templates/base.html | 14 |
4 files changed, 52 insertions, 7 deletions
diff --git a/ishtar/furnitures/context_processors.py b/ishtar/furnitures/context_processors.py new file mode 100644 index 000000000..ae1bbc36d --- /dev/null +++ b/ishtar/furnitures/context_processors.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2010 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# See the file COPYING for details. + +from ishtar import settings + +def get_base_context(request): + dct = {} + if settings.APP_NAME: + dct["APP_NAME"] = settings.APP_NAME + return dct + diff --git a/ishtar/furnitures/views.py b/ishtar/furnitures/views.py index 28e078cd3..9ec293ee8 100644 --- a/ishtar/furnitures/views.py +++ b/ishtar/furnitures/views.py @@ -24,14 +24,13 @@ Furnitures views from django.template import RequestContext from django.shortcuts import render_to_response -def get_base_info(request): - dct = {} - return RequestContext(request, dct) +from ishtar import settings def index(request): """ Main page """ - dct = get_base_info(request) - return render_to_response('index.html', dct) + dct = {} + return render_to_response('index.html', dct, + context_instance=RequestContext(request)) diff --git a/ishtar/settings.py.example b/ishtar/settings.py.example index 0b1177830..2fe347345 100644 --- a/ishtar/settings.py.example +++ b/ishtar/settings.py.example @@ -2,6 +2,7 @@ # Ishtar custom SRID = 27572 +APP_NAME = "" ROOT_PATH = "/var/local/webapp/ishtar/ishtar/" URL_PATH = "" @@ -83,6 +84,14 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', ) +TEMPLATE_CONTEXT_PROCESSORS = ( + 'furnitures.context_processors.get_base_context', + "django.core.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", +) + ROOT_URLCONF = 'ishtar.urls' TEMPLATE_DIRS = ( diff --git a/ishtar/templates/base.html b/ishtar/templates/base.html index 4f8282bbe..e26a5ddab 100644 --- a/ishtar/templates/base.html +++ b/ishtar/templates/base.html @@ -5,7 +5,9 @@ <head> <link rel="stylesheet" href="{{MEDIA_URL}}/style.css" /> - <title>{% block title %}Ishtar{% endblock %}</title> + <link rel="shortcut icon" href="{{MEDIA_URL}}/images/favicon.png"> + <title>{% block title %}Ishtar{% if APP_NAME %} - {{APP_NAME}}{%endif%}{% endblock %} + </title> </head> <body> @@ -20,7 +22,15 @@ {% endif %} {% endblock %} </div> - + <div id="logo"> +{% if APP_NAME %}<p id="app_name">{{APP_NAME}}</p>{%endif%} + </div> + <div id="context_menu"> + {% block context %}{% endblock %} + </div> + <div id="main_menu"> + {% block menu %}{% endblock %} + </div> <div id="content"> {% block content %}{% endblock %} </div> |