diff --git a/logs/locale/fr/LC_MESSAGES/django.po b/logs/locale/fr/LC_MESSAGES/django.po new file mode 100644 index 0000000..6b59f3c --- /dev/null +++ b/logs/locale/fr/LC_MESSAGES/django.po @@ -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 \n" +"Language-Team: LANGUAGE \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" diff --git a/logs/templates/logs/aff_stats_users.html b/logs/templates/logs/aff_stats_users.html deleted file mode 100644 index 3317d8f..0000000 --- a/logs/templates/logs/aff_stats_users.html +++ /dev/null @@ -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 %} - - -

Statistiques par {{ key_dict }} de {{ key }}

- - - - - - - {% for stat in stats %} - - - - - - {% endfor %} -
{{ key_dict }}Nombre de {{ key }} par {{ key_dict }}Rang
{{ stat|truncatechars:25 }}{{ stat.num }}{{ forloop.counter }}
- {% endfor %} -{% endfor %} diff --git a/logs/templates/logs/stats_users.html b/logs/templates/logs/stats_users.html index d77af0e..d80a5d4 100644 --- a/logs/templates/logs/stats_users.html +++ b/logs/templates/logs/stats_users.html @@ -3,9 +3,26 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} -{% block title %}Statistiques par utilisateur{% endblock %} +{% load i18n %} {% block content %} -

Statistiques par utilisateur

- {% include "logs/aff_stats_users.html" with stats_list=stats_list %} + + + + + + + + + + + {% for stat in stats %} + + + + + + {% endfor %} + +
{% trans "user"|capfirst %}{% trans "Database edits" %}{% trans "Rank" %}
{{ stat|truncatechars:25 }}{{ stat.num }}{{ forloop.counter }}
{% endblock %} diff --git a/logs/views.py b/logs/views.py index 4639a94..4eac1a9 100644 --- a/logs/views.py +++ b/logs/views.py @@ -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, + }) diff --git a/med/settings.py b/med/settings.py index 243580a..b9be185 100644 --- a/med/settings.py +++ b/med/settings.py @@ -24,7 +24,7 @@ ADMINS = ( SITE_ID = 1 -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['127.0.0.1'] # Application definition diff --git a/med/settings_local.example.py b/med/settings_local.example.py index aac1333..214c600 100644 --- a/med/settings_local.example.py +++ b/med/settings_local.example.py @@ -3,7 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Needed to filter which host are trusted -ALLOWED_HOSTS = ['127.0.0.1', 'med.crans.org', 'zamok.crans.org'] +ALLOWED_HOSTS = ['med.crans.org'] # Emails EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' diff --git a/media/tests/test_templates.py b/media/tests/test_templates.py index bdc694a..e4ce582 100644 --- a/media/tests/test_templates.py +++ b/media/tests/test_templates.py @@ -6,7 +6,7 @@ from django.urls import reverse from media.models import Auteur, Media from users.models import User -from django.forms.models import model_to_dict + """ Test that every page render """ diff --git a/theme/templates/admin/base_site.html b/theme/templates/admin/base_site.html index d0c1aaf..b46f09f 100644 --- a/theme/templates/admin/base_site.html +++ b/theme/templates/admin/base_site.html @@ -84,7 +84,8 @@ SPDX-License-Identifier: GPL-3.0-or-later {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %} {% for language in languages %} - {% endfor %} @@ -92,8 +93,23 @@ SPDX-License-Identifier: GPL-3.0-or-later - Mediatek 2017-2020 — Nous contactez + Mediatek 2017-2020 — + Nous contactez {% endif %} + + {# Bind CTRL+S to Save button in forms #} + {% endblock %} diff --git a/theme/templates/admin/change_form.html b/theme/templates/admin/change_form.html deleted file mode 100644 index 9ebd41a..0000000 --- a/theme/templates/admin/change_form.html +++ /dev/null @@ -1,102 +0,0 @@ -{% extends "admin/base_site.html" %} -{% load i18n admin_urls static admin_modify %} - -{% block extrahead %}{{ block.super }} - - {{ media }} -{% endblock %} - -{% block extrastyle %}{{ block.super }} - {% endblock %} - -{% block coltype %}colM{% endblock %} - -{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %} - -{% if not is_popup %} - {% block breadcrumbs %} - - {% endblock %} -{% endif %} - -{% block content %} -
- {% block object-tools %} - {% if change %}{% if not is_popup %} -
    - {% block object-tools-items %} - {% change_form_object_tools %} - {% endblock %} -
- {% endif %}{% endif %} - {% endblock %} -
{% csrf_token %}{% block form_top %}{% endblock %} -
- {% if is_popup %}{% endif %} - {% if to_field %}{% endif %} - {% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %} - {% if errors %} -

- {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %} - {% trans "Please correct the errors below." %}{% endif %} -

- {{ adminform.form.non_field_errors }} - {% endif %} - - {% block field_sets %} - {% for fieldset in adminform %} - {% include "admin/includes/fieldset.html" %} - {% endfor %} - {% endblock %} - - {% block after_field_sets %}{% endblock %} - - {% block inline_field_sets %} - {% for inline_admin_formset in inline_admin_formsets %} - {% include inline_admin_formset.opts.template %} - {% endfor %} - {% endblock %} - - {% block after_related_objects %}{% endblock %} - - {% block submit_buttons_bottom %}{% submit_row %}{% endblock %} - - {% block admin_change_form_document_ready %} - - {% endblock %} - - {# JavaScript for prepopulated fields #} - {% prepopulated_fields_js %} - -
-
-
- - {# Bind CTRL+S to Save button #} - -{% endblock %}