aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-12-26 23:33:21 +0000
committerPaul Eggleton <paul.eggleton@linux.intel.com>2013-12-28 11:03:29 +0000
commit75c44fd770ffa1890159b516c7b0cc59669dea7e (patch)
treece5ba766a6bfd4f4c396658ab000f01326eb4a25
parent5ce6448a1207d2797b3079323033d513e106dfdf (diff)
downloadopenembedded-core-contrib-75c44fd770ffa1890159b516c7b0cc59669dea7e.tar.gz
Use Django sites framework to specify website title
This allows specifying the site title in the database, instead of hardcoding it in the template. Just change it to something other than "example.com" to apply your own title. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--README7
-rw-r--r--layerindex/context_processors.py9
-rw-r--r--templates/admin/base_site.html3
-rw-r--r--templates/base.html4
4 files changed, 18 insertions, 5 deletions
diff --git a/README b/README
index 4754937d4a..070c8dd689 100644
--- a/README
+++ b/README
@@ -95,7 +95,12 @@ Setup instructions:
next to your login name at the top right, click on the
newly added layer entry, and then click on "Publish Layer".
-5. You may wish to customise some of the page templates to suit your
+5. Set the site name (as displayed in the top bar and page titles) by
+ going into the admin interface (http://127.0.0.1:8000/admin/),
+ clicking on "Sites" at the bottom, and editing the first entry,
+ setting "Display name" to the desired name.
+
+6. You may wish to customise some of the page templates to suit your
installation, in particular:
* templates/base.html
* templates/layerindex/about.html
diff --git a/layerindex/context_processors.py b/layerindex/context_processors.py
index ba0664d205..e2852ee2e9 100644
--- a/layerindex/context_processors.py
+++ b/layerindex/context_processors.py
@@ -5,10 +5,17 @@
# Licensed under the MIT license, see COPYING.MIT for details
from layerindex.models import Branch, LayerItem
+from django.contrib.sites.models import Site
def layerindex_context(request):
+ site = Site.objects.get_current()
+ if site and site.name and site.name != 'example.com':
+ site_name = site.name
+ else:
+ site_name = 'OpenEmbedded metadata index'
return {
'all_branches': Branch.objects.exclude(name='oe-classic').order_by('sort_priority'),
'unpublished_count': LayerItem.objects.filter(status='N').count(),
- 'oe_classic': Branch.objects.filter(name='oe-classic')
+ 'oe_classic': Branch.objects.filter(name='oe-classic'),
+ 'site_name': site_name
} \ No newline at end of file
diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html
index 0fcc54e62e..45b6d1d3ad 100644
--- a/templates/admin/base_site.html
+++ b/templates/admin/base_site.html
@@ -1,5 +1,6 @@
{% extends "admin/base.html" %}
+{% block title %}{{ site_name }} Admin{% endblock %}
{% block branding %}
-<h1 id="site-name">OpenEmbedded Metadata Index Admin</h1>
+<h1 id="site-name">{{ site_name }} Admin</h1>
{% endblock %}
diff --git a/templates/base.html b/templates/base.html
index 9ac80c6d6c..c872383ccd 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -19,7 +19,7 @@
<link rel="stylesheet" href="{% static "css/bootstrap-responsive.css" %}" />
<link rel="stylesheet" href="{% static "css/additional.css" %}" />
<link rel="icon" type="image/vnd.microsoft.icon" href="{% static "img/favicon.ico" %}" />
- <title>OpenEmbedded metadata index{% block title_append %} - {% endblock %}</title>
+ <title>{{ site_name }}{% block title_append %} - {% endblock %}</title>
</head>
<body>
@@ -28,7 +28,7 @@
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
- <a class="brand" href="{% url frontpage %}">OpenEmbedded metadata index</a>
+ <a class="brand" href="{% url frontpage %}">{{ site_name }}</a>
{% if user.is_authenticated %}
<div class="btn-group pull-right">