From 9613d00256229da0fa8a3a40776aa670a31efef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Sat, 9 Sep 2017 18:59:51 +0000 Subject: [PATCH] =?UTF-8?q?Duplique=20l'affichage=20des=20=C3=A9venement?= =?UTF-8?q?=20dans=20une=20nouvelle=20page=20"logs"=20Permet=20de=20laisse?= =?UTF-8?q?r=20la=20place=20=C3=A0=20un=20r=C3=A9sum=C3=A9=20dans=20le=20/?= =?UTF-8?q?index.html=20de=20stats?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{aff_actions.html => aff_stats_logs.html} | 0 logs/templates/logs/aff_summary.html | 61 +++++++++++++++++++ logs/templates/logs/index.html | 2 +- logs/templates/logs/sidebar.html | 4 ++ logs/templates/logs/stats_logs.html | 36 +++++++++++ logs/urls.py | 1 + logs/views.py | 18 ++++++ 7 files changed, 121 insertions(+), 1 deletion(-) rename logs/templates/logs/{aff_actions.html => aff_stats_logs.html} (100%) create mode 100644 logs/templates/logs/aff_summary.html create mode 100644 logs/templates/logs/stats_logs.html diff --git a/logs/templates/logs/aff_actions.html b/logs/templates/logs/aff_stats_logs.html similarity index 100% rename from logs/templates/logs/aff_actions.html rename to logs/templates/logs/aff_stats_logs.html diff --git a/logs/templates/logs/aff_summary.html b/logs/templates/logs/aff_summary.html new file mode 100644 index 00000000..35504144 --- /dev/null +++ b/logs/templates/logs/aff_summary.html @@ -0,0 +1,61 @@ +{% comment %} +Re2o est un logiciel d'administration développé initiallement au rezometz. Il +se veut agnostique au réseau considéré, de manière à être installable en +quelques clics. + +Copyright © 2017 Gabriel Détraz +Copyright © 2017 Goulven Kermarec +Copyright © 2017 Augustin Lemesle + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +{% endcomment %} + +{% if revisions_list.paginator %} +{% include "pagination.html" with list=revisions_list %} +{% endif %} + +{% load logs_extra %} + + + + + + + + + + + + + {% for revision in revisions_list %} + {% for reversion in revision.version_set.all %} + + + + + + + {% if is_bureau %} + + {% endif %} + + {% endfor %} + {% endfor %} +
Objet modifiéType de l'objetModification parDate de modificationCommentaire
{{ reversion.object|truncatechars:20 }}{{ reversion.object|classname }}{{ revision.user }}{{ revision.date_created }}{{ revision.comment }} + + + Annuler + +
diff --git a/logs/templates/logs/index.html b/logs/templates/logs/index.html index 0255672e..baeb1cd7 100644 --- a/logs/templates/logs/index.html +++ b/logs/templates/logs/index.html @@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block content %}

Actions effectuées

- {% include "logs/aff_actions.html" with revisions_list=revisions_list %} + {% include "logs/aff_summary.html" with revisions_list=revisions_list %}


diff --git a/logs/templates/logs/sidebar.html b/logs/templates/logs/sidebar.html index cd8bc02f..4137741f 100644 --- a/logs/templates/logs/sidebar.html +++ b/logs/templates/logs/sidebar.html @@ -27,6 +27,10 @@ with this program; if not, write to the Free Software Foundation, Inc., {% block sidebar %} {% if is_cableur %} + + Résumé + + Évènements diff --git a/logs/templates/logs/stats_logs.html b/logs/templates/logs/stats_logs.html new file mode 100644 index 00000000..4db77c68 --- /dev/null +++ b/logs/templates/logs/stats_logs.html @@ -0,0 +1,36 @@ +{% extends "logs/sidebar.html" %} +{% comment %} +Re2o est un logiciel d'administration développé initiallement au rezometz. Il +se veut agnostique au réseau considéré, de manière à être installable en +quelques clics. + +Copyright © 2017 Gabriel Détraz +Copyright © 2017 Goulven Kermarec +Copyright © 2017 Augustin Lemesle + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +{% endcomment %} + +{% load bootstrap3 %} + +{% block title %}Statistiques{% endblock %} + +{% block content %} +

Actions effectuées

+ {% include "logs/aff_stats_logs.html" with revisions_list=revisions_list %} +
+
+
+ {% endblock %} diff --git a/logs/urls.py b/logs/urls.py index 832288e0..b3d4b33b 100644 --- a/logs/urls.py +++ b/logs/urls.py @@ -26,6 +26,7 @@ from . import views urlpatterns = [ url(r'^$', views.index, name='index'), + url(r'^stats_logs$', views.stats_logs, name='stats-logs'), url(r'^revert_action/(?P[0-9]+)$', views.revert_action, name='revert-action'), url(r'^stats_general/$', views.stats_general, name='stats-general'), url(r'^stats_models/$', views.stats_models, name='stats-models'), diff --git a/logs/views.py b/logs/views.py index b20f1b5f..4be87899 100644 --- a/logs/views.py +++ b/logs/views.py @@ -82,6 +82,24 @@ def index(request): revisions = paginator.page(paginator.num_pages) return render(request, 'logs/index.html', {'revisions_list': revisions}) +@login_required +@permission_required('cableur') +def stats_logs(request): + options, created = GeneralOption.objects.get_or_create() + pagination_number = options.pagination_number + revisions = Revision.objects.all().order_by('date_created').reverse().select_related('user').prefetch_related('version_set__object') + paginator = Paginator(revisions, pagination_number) + page = request.GET.get('page') + try: + revisions = paginator.page(page) + except PageNotAnInteger: + # If page is not an integer, deliver first page. + revisions = paginator.page(1) + except EmptyPage: + # If page is out of range (e.g. 9999), deliver last page of results. + revisions = paginator.page(paginator.num_pages) + return render(request, 'logs/stats_logs.html', {'revisions_list': revisions}) + @login_required @permission_required('bureau') def revert_action(request, revision_id):