xmpp.chapril.org-conversejs/trans/views.py

30 lines
1.1 KiB
Python
Raw Normal View History

2012-02-27 11:18:49 +01:00
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from trans.models import Project, SubProject, Translation, Unit
def show_project(request, project):
obj = get_object_or_404(Project, slug = project)
2012-02-27 11:58:55 +01:00
return render_to_response('project.html', RequestContext(request, {
2012-02-27 11:18:49 +01:00
'object': obj,
2012-02-27 11:34:32 +01:00
'title': '%s @ Weblate' % obj.name,
2012-02-27 11:47:34 +01:00
}))
2012-02-27 11:18:49 +01:00
def show_subproject(request, project, subproject):
obj = get_object_or_404(SubProject, slug = subproject, project__slug = project)
2012-02-27 11:58:55 +01:00
return render_to_response('subproject.html', RequestContext(request, {
2012-02-27 11:18:49 +01:00
'object': obj,
2012-02-27 11:34:32 +01:00
'title': '%s/%s @ Weblate' % (obj.name, obj.project.name),
2012-02-27 11:47:34 +01:00
}))
2012-02-27 11:18:49 +01:00
def show_translation(request, project, subproject, lang):
obj = get_object_or_404(Language, language__code = lang, subproject__slug = subproject, subproject__project__slug = project)
2012-02-27 11:58:55 +01:00
return render_to_response('translation.html', RequestContext(request, {
2012-02-27 11:18:49 +01:00
'object': obj,
2012-02-27 11:34:32 +01:00
'title': '%s %s/%s @ Weblate' % (obj.language.name, obj.subproject.name, obj.subproject.project.name),
2012-02-27 11:47:34 +01:00
}))
2012-02-27 11:18:49 +01:00