From d17ebb1475f3be25bdf87e51195530b7ff4daeb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 5 Mar 2012 13:55:09 +0100 Subject: [PATCH] Show some user stats --- html/index.html | 39 +++++++++++++++++++++++++++++++++++++++ trans/views.py | 6 ++++++ 2 files changed, 45 insertions(+) diff --git a/html/index.html b/html/index.html index 3f8f82b27..8596188c5 100644 --- a/html/index.html +++ b/html/index.html @@ -24,5 +24,44 @@ +

{% trans "Users" %}

+ +

{% trans "Best translators" %}

+ + + + + + + + +{% for u in top_translations %} + + + + +{% endfor %} + +
{% trans "User" %}{% trans "Translated" %}
{{ u.user.get_full_name }}{{ u.translated }}
+ +

{% trans "Best suggestions" %}

+ + + + + + + + +{% for u in top_suggestions %} + + + + +{% endfor %} + +
{% trans "User" %}{% trans "Suggested" %}
{{ u.user.get_full_name }}{{ u.suggested }}
+ + {% endblock %} diff --git a/trans/views.py b/trans/views.py index 552e8daa7..c36751a76 100644 --- a/trans/views.py +++ b/trans/views.py @@ -11,6 +11,7 @@ from django.contrib.auth.models import AnonymousUser from trans.models import Project, SubProject, Translation, Unit, Suggestion from trans.forms import TranslationForm, UploadForm from util import is_plural, split_plural, join_plural +from accounts.models import Profile import logging import os.path @@ -19,8 +20,13 @@ logger = logging.getLogger('weblate') def home(request): projects = Project.objects.all() + top_translations = Profile.objects.order_by('-translated')[:10] + top_suggestions = Profile.objects.order_by('-suggested')[:10] + return render_to_response('index.html', RequestContext(request, { 'projects': projects, + 'top_translations': top_translations, + 'top_suggestions': top_suggestions, 'title': settings.SITE_TITLE, }))