1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-12-24 17:42:23 +00: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
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
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,
})

View File

@ -24,7 +24,7 @@ ADMINS = (
SITE_ID = 1
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['127.0.0.1']
# Application definition

View File

@ -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'

View File

@ -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
"""

View File

@ -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 %}
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
<option value="{{ language.code }}"
{% if language.code == LANGUAGE_CODE %} selected{% endif %}>
{{ language.name_local }} ({{ language.code }})
</option>
{% endfor %}
@ -92,8 +93,23 @@ SPDX-License-Identifier: GPL-3.0-or-later
<noscript>
<input type="submit">
</noscript>
Mediatek 2017-2020 &mdash; <a href="mailto:club-med@crans.org">Nous contactez</a>
Mediatek 2017-2020 &mdash;
<a href="mailto:club-med@crans.org">Nous contactez</a>
</form>
</div>
{% endif %}
{# Bind CTRL+S to Save button in forms #}
<script type="text/javascript">
if (typeof django !== 'undefined') {
django.jQuery(window).bind('keydown', function (event) {
if (event.ctrlKey || event.metaKey) {
if (String.fromCharCode(event.which).toLowerCase() === 's') {
event.preventDefault();
django.jQuery("#content-main form input[name=_save]").click();
}
}
});
}
</script>
{% endblock %}

View File

@ -1,102 +0,0 @@
{% extends "admin/base_site.html" %}
{% load i18n admin_urls static admin_modify %}
{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{{ media }}
{% endblock %}
{% block extrastyle %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">{% 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 %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a
href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
&rsaquo; {% if has_view_permission %}
<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}
{{ opts.verbose_name_plural|capfirst }}{% endif %}
&rsaquo; {% if add %}{% blocktrans with name=opts.verbose_name %}Add {{ name }}{% endblocktrans %}{% else %}
{{ original|truncatewords:"18" }}{% endif %}
</div>
{% endblock %}
{% endif %}
{% block content %}
<div id="content-main">
{% block object-tools %}
{% if change %}{% if not is_popup %}
<ul class="object-tools">
{% block object-tools-items %}
{% change_form_object_tools %}
{% endblock %}
</ul>
{% endif %}{% endif %}
{% endblock %}
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post"
id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1">{% endif %}
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}">{% endif %}
{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %}
{% if errors %}
<p class="errornote">
{% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}
{% trans "Please correct the errors below." %}{% endif %}
</p>
{{ 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 %}
<script type="text/javascript"
id="django-admin-form-add-constants"
src="{% static 'admin/js/change_form.js' %}"
{% if adminform and add %}
data-model-name="{{ opts.model_name }}"
{% endif %}>
</script>
{% endblock %}
{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}
</div>
</form>
</div>
{# Bind CTRL+S to Save button #}
<script type="text/javascript">
django.jQuery(window).bind('keydown', function (event) {
if (event.ctrlKey || event.metaKey) {
if (String.fromCharCode(event.which).toLowerCase() === 's') {
event.preventDefault();
django.jQuery("#content-main form input[name=_save]").click();
}
}
});
</script>
{% endblock %}