Commit a68948ae authored by eric's avatar eric

User configurable site-name

Displayed on homepage and in the <title> field.

Uses the django sites framework: run `python manage.py syncdb`
to add the necessary database tables. You can set the site-name
in the ‘Sites’ section in the admin.
parent 68d3b7b4
......@@ -2,8 +2,16 @@ from datetime import datetime
from etherpadlite.models import Pad, PadAuthor, PadServer
from django.contrib.auth.models import AnonymousUser
from django.contrib.sites.models import get_current_site
from gitcommits.models import commits
def site_name(request):
current_site = get_current_site(request)
# maybe something that sounds more to the point than stite_name?
# project_name? wiki_name?
return { 'site_name' : current_site.name }
def pads(request):
hash = {}
if 'admin' in request.path:
......
......@@ -42,6 +42,8 @@ USE_L10N = True
# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True
SITE_ID = 1
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/var/www/example.com/media/"
MEDIA_ROOT = ''
......@@ -110,6 +112,7 @@ TEMPLATE_DIRS = (
)
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
"relearn.context_processors.site_name",
"relearn.context_processors.pads",
# "relearn.context_processors.compose_commits",
)
......@@ -118,7 +121,7 @@ INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
# 'django.contrib.sites',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
......
......@@ -9,7 +9,7 @@
<script src="{{ STATIC_URL }}js/jquery-1.10.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="{{ STATIC_URL }}js/relearn.js" type="text/javascript" charset="utf-8"></script>
<title>Relearn{% if pad %} → {{ pad.display_name }}{% endif %}</title>
<title>{{ site_name }}{% if pad %} → {{ pad.display_name }}{% endif %}</title>
{% block extra_styles %}{% endblock %}
......@@ -17,7 +17,7 @@
<body>
<div class="wrap screen-only" style="min-height: 15%;">
<div class="left-side">
<h1><a href="{% url 'home' %}">Relearn</a></h1>
<h1><a href="{% url 'home' %}">{{ site_name }}</a></h1>
</div>
<div class="middle">
{% block title %}{% endblock %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment