mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Affichage des dernières actions
This commit is contained in:
parent
9be7e8a00a
commit
02e0307340
9 changed files with 96 additions and 3 deletions
26
logs/templates/logs/aff_actions.html
Normal file
26
logs/templates/logs/aff_actions.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
{% if revisions_list.paginator %}
|
||||
{% include "pagination.html" with list=revisions_list %}
|
||||
{% endif %}
|
||||
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Objet modifié</th>
|
||||
<th>Type de l'objet</th>
|
||||
<th>Modification par</th>
|
||||
<th>Date de modification</th>
|
||||
<th>Commentaire</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for revision in revisions_list %}
|
||||
<tr>
|
||||
<td>{% for reversion in revision.version_set.all %}{{ reversion.object|truncatechars:20 }}{% endfor %}</td>
|
||||
<td>{% for reversion in revision.version_set.all %}{{ reversion.object|classname }}{% endfor %}</td>
|
||||
<td>{{ revision.user }}</td>
|
||||
<td>{{ revision.date_created }}</td>
|
||||
<td>{{ revision.comment }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
12
logs/templates/logs/index.html
Normal file
12
logs/templates/logs/index.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% extends "logs/sidebar.html" %}
|
||||
{% load bootstrap3 %}
|
||||
|
||||
{% block title %}Statistiques{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Actions effectuées</h2>
|
||||
{% include "logs/aff_actions.html" with revisions_list=revisions_list %}
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
{% endblock %}
|
6
logs/templates/logs/sidebar.html
Normal file
6
logs/templates/logs/sidebar.html
Normal file
|
@ -0,0 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% if is_cableur %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
0
logs/templatetags/__init__.py
Normal file
0
logs/templatetags/__init__.py
Normal file
8
logs/templatetags/logs_extra.py
Normal file
8
logs/templatetags/logs_extra.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter
|
||||
def classname(obj):
|
||||
return obj.__class__.__name__
|
||||
|
7
logs/urls.py
Normal file
7
logs/urls.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.index, name='index'),
|
||||
]
|
|
@ -1,2 +1,36 @@
|
|||
from django.shortcuts import render
|
||||
# App de gestion des statistiques pour re2o
|
||||
# Gabriel Détraz
|
||||
# Gplv2
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render, redirect
|
||||
from django.shortcuts import render_to_response, get_object_or_404
|
||||
from django.core.context_processors import csrf
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.template import Context, RequestContext, loader
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required, permission_required
|
||||
from django.db.models import ProtectedError
|
||||
from django.forms import ValidationError
|
||||
from django.db import transaction
|
||||
|
||||
from reversion.models import Revision
|
||||
from reversion.models import Version
|
||||
|
||||
from re2o.settings import PAGINATION_NUMBER, PAGINATION_LARGE_NUMBER
|
||||
|
||||
@login_required
|
||||
@permission_required('cableur')
|
||||
def index(request):
|
||||
revisions = Revision.objects.all().order_by('date_created').reverse()
|
||||
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/index.html', {'revisions_list': revisions})
|
||||
|
||||
|
|
|
@ -28,5 +28,5 @@ urlpatterns = [
|
|||
url(r'^cotisations/', include('cotisations.urls', namespace='cotisations')),
|
||||
url(r'^machines/', include('machines.urls', namespace='machines')),
|
||||
url(r'^topologie/', include('topologie.urls', namespace='topologie')),
|
||||
#url(r'^logs/', include('logs.urls', namespace='logs')),
|
||||
url(r'^logs/', include('logs.urls', namespace='logs')),
|
||||
]
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<li><a href="{% url "machines:index" %}">Machines</a></li>
|
||||
<li><a href="{% url "cotisations:index" %}">Cotisations</a></li>
|
||||
<li><a href="{% url "topologie:index" %}">Topologie</a></li>
|
||||
<li><a href="#">Statistiques</a></li>
|
||||
<li><a href="{% url "logs:index" %}">Statistiques</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<div class="col-sm-3 col-md-3 navbar-right">
|
||||
|
|
Loading…
Reference in a new issue