Add index page

This commit is contained in:
Michal Čihař 2012-02-29 11:16:05 +01:00
parent f035c91c26
commit 75daafb7bf
3 changed files with 27 additions and 0 deletions

15
html/index.html Normal file
View File

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<h2>{% trans "Projects" %}</h2>
<ul>
{% for prj in projects %}
<li><a href="{{ prj.get_absolute_url }}">{{ prj.name }}</a></li>
{% endfor %}
</ul>
{% endblock %}

View File

@ -190,3 +190,6 @@ LOGGING = {
# Path where git repositories are stored, it needs to be writable
GIT_ROOT = '%s/repos/' % WEB_ROOT
# Title of site to use
SITE_TITLE = 'Weblate'

View File

@ -1,8 +1,17 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.conf import settings
from trans.models import Project, SubProject, Translation, Unit
def home(request):
projects = Project.objects.all()
return render_to_response('index.html', RequestContext(request, {
'projects': projects,
'title': settings.SITE_TITLE,
}))
def show_project(request, project):
obj = get_object_or_404(Project, slug = project)