1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-06-29 19:51:08 +02:00

Translate logs app and cleanup

This commit is contained in:
Alexandre Iooss
2019-08-16 20:14:52 +02:00
parent c2ab1e4bc5
commit 670f7dfa39
9 changed files with 77 additions and 149 deletions

View File

@ -0,0 +1,30 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-16 20:13+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: templates/logs/stats_users.html:12
msgid "user"
msgstr "utilisateur"
#: templates/logs/stats_users.html:13
msgid "Database edits"
msgstr "Éditions de la base de données"
#: templates/logs/stats_users.html:14
msgid "Rank"
msgstr "Rang"
#: views.py:41
msgid "Database edits by user"
msgstr "Éditions de la base de données par utilisateur"

View File

@ -1,25 +0,0 @@
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% for key_dict, stats_dict in stats_list.items %}
{% for key, stats in stats_dict.items %}
<table class="table table-striped">
<thead>
<h4>Statistiques par {{ key_dict }} de {{ key }}</h4>
<tr>
<th>{{ key_dict }}</th>
<th>Nombre de {{ key }} par {{ key_dict }}</th>
<th>Rang</th>
</tr>
</thead>
{% for stat in stats %}
<tr>
<td>{{ stat|truncatechars:25 }}</td>
<td>{{ stat.num }}</td>
<td>{{ forloop.counter }}</td>
</tr>
{% endfor %}
</table>
{% endfor %}
{% endfor %}

View File

@ -3,9 +3,26 @@
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% block title %}Statistiques par utilisateur{% endblock %}
{% load i18n %}
{% block content %}
<h2>Statistiques par utilisateur</h2>
{% include "logs/aff_stats_users.html" with stats_list=stats_list %}
<table class="table">
<thead>
<tr>
<th>{% trans "user"|capfirst %}</th>
<th>{% trans "Database edits" %}</th>
<th>{% trans "Rank" %}</th>
</tr>
</thead>
<tbody>
{% for stat in stats %}
<tr>
<td>{{ stat|truncatechars:25 }}</td>
<td>{{ stat.num }}</td>
<td>{{ forloop.counter }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -7,19 +7,13 @@ from django.contrib.auth.decorators import login_required
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db.models import Count
from django.shortcuts import render
from django.template.context_processors import csrf
from django.utils.translation import gettext_lazy as _
from reversion.models import Revision
from med.settings import PAGINATION_NUMBER
from users.models import User
def form(ctx, template, request):
c = ctx
c.update(csrf(request))
return render(request, template, c)
@login_required
@staff_member_required
def index(request):
@ -42,10 +36,8 @@ def index(request):
@login_required
@staff_member_required
def stats_actions(request):
stats = {
'Utilisateur': {
'Action': User.objects.annotate(num=Count('revision')).order_by(
'-num')[:40],
},
}
return render(request, 'logs/stats_users.html', {'stats_list': stats})
stats = User.objects.annotate(num=Count('revision')).order_by('-num')[:10]
return render(request, 'logs/stats_users.html', {
'title': _("Database edits by user"),
'stats': stats,
})