Commit 02e03073 authored by chirac's avatar chirac

Affichage des dernières actions

parent 9be7e8a0
{% 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>
{% 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 %}
{% extends "base.html" %}
{% block sidebar %}
{% if is_cableur %}
{% endif %}
{% endblock %}
from django import template
register = template.Library()
@register.filter
def classname(obj):
return obj.__class__.__name__
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment