mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
fix #65, gestion propre de l'historique.
This commit is contained in:
parent
cfa6fe097d
commit
6b945bf322
51 changed files with 1218 additions and 1279 deletions
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load acl %}
|
||||
{% load i18n %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
@ -51,9 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
{% acl_end %}
|
||||
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'article' article.id %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button article %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load acl %}
|
||||
{% load i18n %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
@ -41,9 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
{% acl_end %}
|
||||
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'banque' banque.id %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button banque %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load acl %}
|
||||
{% load i18n %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
{% if facture_list.paginator %}
|
||||
|
@ -86,9 +87,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</li>
|
||||
{% acl_end %}
|
||||
<li>
|
||||
<a href="{% url 'cotisations:history' 'facture' facture.id %}">
|
||||
<i class="fa fa-history"></i> {% trans "Historique" %}
|
||||
</a>
|
||||
{% history_button facture text='History' html_class=''%}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load acl %}
|
||||
{% load i18n %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
@ -47,9 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<i class="fa fa-edit"></i>
|
||||
</a>
|
||||
{% acl_end %}
|
||||
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'paiement' paiement.id %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button paiement %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -27,7 +27,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from django.conf.urls import url
|
||||
|
||||
import re2o
|
||||
from . import views
|
||||
from . import payment_methods
|
||||
|
||||
|
@ -122,12 +121,6 @@ urlpatterns = [
|
|||
views.index_paiement,
|
||||
name='index-paiement'
|
||||
),
|
||||
url(
|
||||
r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||
re2o.views.history,
|
||||
name='history',
|
||||
kwargs={'application': 'cotisations'},
|
||||
),
|
||||
url(
|
||||
r'^control/$',
|
||||
views.control,
|
||||
|
|
|
@ -33,3 +33,15 @@ register = template.Library()
|
|||
def classname(obj):
|
||||
""" Returns the object class name """
|
||||
return obj.__class__.__name__
|
||||
|
||||
|
||||
@register.inclusion_tag('buttons/history.html')
|
||||
def history_button(instance, text=None, html_class=None):
|
||||
"""Creates the correct history button for an instance."""
|
||||
return {
|
||||
'application': instance._meta.app_label,
|
||||
'name': instance._meta.model_name,
|
||||
'id': instance.id,
|
||||
'text': text,
|
||||
'class': html_class,
|
||||
}
|
||||
|
|
|
@ -39,4 +39,9 @@ urlpatterns = [
|
|||
url(r'^stats_models/$', views.stats_models, name='stats-models'),
|
||||
url(r'^stats_users/$', views.stats_users, name='stats-users'),
|
||||
url(r'^stats_actions/$', views.stats_actions, name='stats-actions'),
|
||||
url(
|
||||
r'(?P<application>\w+)/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||
views.history,
|
||||
name='history',
|
||||
),
|
||||
]
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
# 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
|
||||
# Copyright © 2018 Gabriel Détraz
|
||||
# Copyright © 2018 Goulven Kermarec
|
||||
# Copyright © 2018 Augustin Lemesle
|
||||
# Copyright © 2018 Hugo Levy-Falk
|
||||
#
|
||||
# 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
|
||||
|
@ -36,12 +37,15 @@ nombre d'objets par models, nombre d'actions par user, etc
|
|||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from itertools import chain
|
||||
|
||||
from django.urls import reverse
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import Http404
|
||||
from django.db.models import Count, Max, F
|
||||
from django.apps import apps
|
||||
|
||||
from reversion.models import Revision
|
||||
from reversion.models import Version, ContentType
|
||||
|
@ -453,3 +457,61 @@ def stats_actions(request):
|
|||
},
|
||||
}
|
||||
return render(request, 'logs/stats_users.html', {'stats_list': stats})
|
||||
|
||||
|
||||
def history(request, application, object_name, object_id):
|
||||
"""Render history for a model.
|
||||
|
||||
The model is determined using the `HISTORY_BIND` dictionnary if none is
|
||||
found, raises a Http404. The view checks if the user is allowed to see the
|
||||
history using the `can_view` method of the model.
|
||||
|
||||
Args:
|
||||
request: The request sent by the user.
|
||||
application: Name of the application.
|
||||
object_name: Name of the model.
|
||||
object_id: Id of the object you want to acces history.
|
||||
|
||||
Returns:
|
||||
The rendered page of history if access is granted, else the user is
|
||||
redirected to their profile page, with an error message.
|
||||
|
||||
Raises:
|
||||
Http404: This kind of models doesn't have history.
|
||||
"""
|
||||
try:
|
||||
model = apps.get_model(application, object_name)
|
||||
except LookupError:
|
||||
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
|
||||
object_name_id = object_name + 'id'
|
||||
kwargs = {object_name_id: object_id}
|
||||
try:
|
||||
instance = model.get_instance(**kwargs)
|
||||
except model.DoesNotExist:
|
||||
messages.error(request, u"Entrée inexistante")
|
||||
return redirect(reverse(
|
||||
'users:profil',
|
||||
kwargs={'userid': str(request.user.id)}
|
||||
))
|
||||
can, msg = instance.can_view(request.user)
|
||||
if not can:
|
||||
messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu")
|
||||
return redirect(reverse(
|
||||
'users:profil',
|
||||
kwargs={'userid': str(request.user.id)}
|
||||
))
|
||||
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
||||
reversions = Version.objects.get_for_object(instance)
|
||||
if hasattr(instance, 'linked_objects'):
|
||||
for related_object in chain(instance.linked_objects()):
|
||||
reversions = (reversions |
|
||||
Version.objects.get_for_object(related_object))
|
||||
reversions = re2o_paginator(request, reversions, pagination_number)
|
||||
return render(
|
||||
request,
|
||||
're2o/history.html',
|
||||
{'reversions': reversions, 'object': instance}
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Alias</th>
|
||||
|
@ -38,9 +39,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit alias %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='domain' id=alias.id %}
|
||||
{% history_button alias %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
|
@ -51,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit extension %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='extension' id=extension.id %}
|
||||
{% history_button extension %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
@ -51,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit type %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='iptype' id=type.id %}
|
||||
{% history_button type %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Ipv6</th>
|
||||
|
@ -43,9 +44,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_delete ipv6 %}
|
||||
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='ipv6list' id=ipv6.id %}
|
||||
{% history_button ipv6 %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -23,13 +23,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
{% if machines_list.paginator %}
|
||||
{% include "pagination.html" with list=machines_list %}
|
||||
{% endif %}
|
||||
{% if machines_list.paginator %}
|
||||
{% include "pagination.html" with list=machines_list %}
|
||||
{% endif %}
|
||||
|
||||
<table class="table" id="machines_table">
|
||||
<table class="table" id="machines_table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
|
@ -56,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_create Interface machine.id %}
|
||||
{% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc='Ajouter une interface' %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='machine' id=machine.id %}
|
||||
{% history_button machine %}
|
||||
{% can_delete machine %}
|
||||
{% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %}
|
||||
{% acl_end %}
|
||||
|
@ -127,7 +128,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% acl_end %}
|
||||
</ul>
|
||||
</div>
|
||||
{% include 'buttons/history.html' with href='machines:history' name='interface' id=interface.id %}
|
||||
{% history_button interface %}
|
||||
{% can_delete interface %}
|
||||
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
|
||||
{% acl_end %}
|
||||
|
@ -176,11 +177,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
<script>
|
||||
$("#machines_table").ready( function() {
|
||||
var alias_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.domain.related_domain.all %}$("#collapseDomain_{{interface.id}}"), {% endif %}{% endfor %}{% endfor %}];
|
||||
for (var i=0 ; i<alias_div.length ; i++) {
|
||||
|
@ -193,9 +194,9 @@ $("#machines_table").ready( function() {
|
|||
ipv6_div[i].collapse('hide');
|
||||
}
|
||||
} );
|
||||
</script>
|
||||
</script>
|
||||
|
||||
{% if machines_list.paginator %}
|
||||
{% include "pagination.html" with list=machines_list %}
|
||||
{% endif %}
|
||||
{% if machines_list.paginator %}
|
||||
{% include "pagination.html" with list=machines_list %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type de machine</th>
|
||||
|
@ -40,9 +41,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit type %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='machinetype' id=type.id %}
|
||||
{% history_button type %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zone concernée</th>
|
||||
|
@ -43,10 +44,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit mx %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='mx' id=mx.id %}
|
||||
{% history_button mx %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
|
@ -46,9 +47,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit nas %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='nas' id=nas.id %}
|
||||
{% history_button nas %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zone concernée</th>
|
||||
|
@ -41,10 +42,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit ns %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='ns' id=ns.id %}
|
||||
{% history_button ns %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom du service</th>
|
||||
|
@ -43,5 +43,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom du service</th>
|
||||
|
@ -45,9 +46,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit service %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='service' id=service.id %}
|
||||
{% history_button service %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
|
@ -49,10 +50,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit soa %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='soa' id=soa.id %}
|
||||
{% history_button soa %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Service</th>
|
||||
|
@ -53,10 +54,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit srv %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='srv' id=srv.id %}
|
||||
{% history_button srv %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zone concernée</th>
|
||||
|
@ -41,10 +42,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit txt %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='txt' id=txt.id %}
|
||||
{% history_button txt %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
|
@ -45,7 +46,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit vlan %}
|
||||
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='machines:history' name='vlan' id=vlan.id %}
|
||||
{% history_button vlan %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -27,7 +27,6 @@ The defined URLs for the Cotisations app
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf.urls import url
|
||||
import re2o
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
|
@ -119,10 +118,6 @@ urlpatterns = [
|
|||
url(r'^edit_nas/(?P<nasid>[0-9]+)$', views.edit_nas, name='edit-nas'),
|
||||
url(r'^del_nas/$', views.del_nas, name='del-nas'),
|
||||
url(r'^index_nas/$', views.index_nas, name='index-nas'),
|
||||
url(r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||
re2o.views.history,
|
||||
name='history',
|
||||
kwargs={'application': 'machines'}),
|
||||
url(r'^$', views.index, name='index'),
|
||||
url(r'^rest/mac-ip/$', views.mac_ip, name='mac-ip'),
|
||||
url(r'^rest/regen-achieved/$',
|
||||
|
|
|
@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -43,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit service%}
|
||||
{% include 'buttons/edit.html' with href='preferences:edit-service' id=service.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='preferences:history' name='service' id=service.id %}
|
||||
{% history_button service %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -27,7 +27,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from django.conf.urls import url
|
||||
|
||||
import re2o
|
||||
from . import views
|
||||
|
||||
|
||||
|
@ -74,11 +73,5 @@ urlpatterns = [
|
|||
name='edit-service'
|
||||
),
|
||||
url(r'^del_services/$', views.del_services, name='del-services'),
|
||||
url(
|
||||
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||
re2o.views.history,
|
||||
name='history',
|
||||
kwargs={'application': 'preferences'},
|
||||
),
|
||||
url(r'^$', views.display_options, name='display-options'),
|
||||
]
|
||||
|
|
123
re2o/views.py
123
re2o/views.py
|
@ -26,33 +26,20 @@ les views
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from itertools import chain
|
||||
import git
|
||||
from reversion.models import Version
|
||||
|
||||
from django.http import Http404
|
||||
from django.urls import reverse
|
||||
from django.shortcuts import render, redirect
|
||||
from django.shortcuts import render
|
||||
from django.template.context_processors import csrf
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib import messages
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
||||
import preferences
|
||||
from preferences.models import (
|
||||
Service,
|
||||
GeneralOption,
|
||||
AssoOption,
|
||||
HomeOption
|
||||
)
|
||||
import users
|
||||
import cotisations
|
||||
import topologie
|
||||
import machines
|
||||
|
||||
from .utils import re2o_paginator
|
||||
from .contributors import CONTRIBUTORS
|
||||
|
||||
|
||||
|
@ -75,118 +62,12 @@ def index(request):
|
|||
return form({
|
||||
'services_urls': services,
|
||||
'twitter_url': twitter_url,
|
||||
'twitter_account_name' : twitter_account_name,
|
||||
'twitter_account_name': twitter_account_name,
|
||||
'facebook_url': facebook_url,
|
||||
'asso_name': asso_name
|
||||
}, 're2o/index.html', request)
|
||||
|
||||
|
||||
#: Binding the corresponding char sequence of history url to re2o models.
|
||||
HISTORY_BIND = {
|
||||
'users': {
|
||||
'user': users.models.User,
|
||||
'ban': users.models.Ban,
|
||||
'whitelist': users.models.Whitelist,
|
||||
'school': users.models.School,
|
||||
'listright': users.models.ListRight,
|
||||
'serviceuser': users.models.ServiceUser,
|
||||
'listshell': users.models.ListShell,
|
||||
},
|
||||
'preferences': {
|
||||
'service': preferences.models.Service,
|
||||
},
|
||||
'cotisations': {
|
||||
'facture': cotisations.models.Facture,
|
||||
'article': cotisations.models.Article,
|
||||
'paiement': cotisations.models.Paiement,
|
||||
'banque': cotisations.models.Banque,
|
||||
},
|
||||
'topologie': {
|
||||
'switch': topologie.models.Switch,
|
||||
'port': topologie.models.Port,
|
||||
'room': topologie.models.Room,
|
||||
'stack': topologie.models.Stack,
|
||||
'modelswitch': topologie.models.ModelSwitch,
|
||||
'constructorswitch': topologie.models.ConstructorSwitch,
|
||||
'accesspoint': topologie.models.AccessPoint,
|
||||
'switchbay': topologie.models.SwitchBay,
|
||||
'building': topologie.models.Building,
|
||||
},
|
||||
'machines': {
|
||||
'machine': machines.models.Machine,
|
||||
'interface': machines.models.Interface,
|
||||
'domain': machines.models.Domain,
|
||||
'machinetype': machines.models.MachineType,
|
||||
'iptype': machines.models.IpType,
|
||||
'extension': machines.models.Extension,
|
||||
'soa': machines.models.SOA,
|
||||
'mx': machines.models.Mx,
|
||||
'txt': machines.models.Txt,
|
||||
'srv': machines.models.Srv,
|
||||
'ns': machines.models.Ns,
|
||||
'service': machines.models.Service,
|
||||
'vlan': machines.models.Vlan,
|
||||
'nas': machines.models.Nas,
|
||||
'ipv6list': machines.models.Ipv6List,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@login_required
|
||||
def history(request, application, object_name, object_id):
|
||||
"""Render history for a model.
|
||||
|
||||
The model is determined using the `HISTORY_BIND` dictionnary if none is
|
||||
found, raises a Http404. The view checks if the user is allowed to see the
|
||||
history using the `can_view` method of the model.
|
||||
|
||||
Args:
|
||||
request: The request sent by the user.
|
||||
object_name: Name of the model.
|
||||
object_id: Id of the object you want to acces history.
|
||||
|
||||
Returns:
|
||||
The rendered page of history if access is granted, else the user is
|
||||
redirected to their profile page, with an error message.
|
||||
|
||||
Raises:
|
||||
Http404: This kind of models doesn't have history.
|
||||
"""
|
||||
try:
|
||||
model = HISTORY_BIND[application][object_name]
|
||||
except KeyError:
|
||||
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
|
||||
object_name_id = object_name + 'id'
|
||||
kwargs = {object_name_id: object_id}
|
||||
try:
|
||||
instance = model.get_instance(**kwargs)
|
||||
except model.DoesNotExist:
|
||||
messages.error(request, u"Entrée inexistante")
|
||||
return redirect(reverse(
|
||||
'users:profil',
|
||||
kwargs={'userid': str(request.user.id)}
|
||||
))
|
||||
can, msg = instance.can_view(request.user)
|
||||
if not can:
|
||||
messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu")
|
||||
return redirect(reverse(
|
||||
'users:profil',
|
||||
kwargs={'userid': str(request.user.id)}
|
||||
))
|
||||
pagination_number = GeneralOption.get_cached_value('pagination_number')
|
||||
reversions = Version.objects.get_for_object(instance)
|
||||
if hasattr(instance, 'linked_objects'):
|
||||
for related_object in chain(instance.linked_objects()):
|
||||
reversions = (reversions |
|
||||
Version.objects.get_for_object(related_object))
|
||||
reversions = re2o_paginator(request, reversions, pagination_number)
|
||||
return render(
|
||||
request,
|
||||
're2o/history.html',
|
||||
{'reversions': reversions, 'object': instance}
|
||||
)
|
||||
|
||||
|
||||
@cache_page(7 * 24 * 60 * 60)
|
||||
def about_page(request):
|
||||
""" The view for the about page.
|
||||
|
|
|
@ -21,7 +21,8 @@ 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 %}
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url href name id %}">
|
||||
<i class="fa fa-history"></i>
|
||||
{% load i18n %}
|
||||
<a class="{{ class |default_if_none:"btn btn-info btn-sm"}}" role="button" title="Historique" href="{% url 'logs:history' application name id %}">
|
||||
<i class="fa fa-history"></i> {% if text %}{% trans text %}{% endif %}
|
||||
</a>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
{% if ap_list.paginator %}
|
||||
|
@ -49,9 +50,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{ap.interface_set.first.details}}</td>
|
||||
<td>{{ap.location}}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'accesspoint' ap.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button ap %}
|
||||
{% can_edit ap %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-ap' ap.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
@ -69,6 +68,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
|
||||
{% if ap_list.paginator %}
|
||||
{% include "pagination.html" with list=ap_list %}
|
||||
{% endif %}
|
||||
{% include "pagination.html" with list=ap_list %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
{% if building_list.paginator %}
|
||||
{% include "pagination.html" with list=building_list %}
|
||||
|
@ -39,9 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<tr>
|
||||
<td>{{building.name}}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'building' building.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button building %}
|
||||
{% can_edit building %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-building' building.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
{% if room_list.paginator %}
|
||||
{% include "pagination.html" with list=room_list %}
|
||||
|
@ -41,9 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{room.name}}</td>
|
||||
<td>{{room.details}}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'room' room.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button room %}
|
||||
{% can_edit room %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-room' room.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
{% if constructor_switch_list.paginator %}
|
||||
{% include "pagination.html" with list=constructor_switch_list %}
|
||||
|
@ -39,9 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<tr>
|
||||
<td>{{constructor_switch}}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'constructorswitch' constructor_switch.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button constructor_switch %}
|
||||
{% can_edit constructor_switch %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-constructor-switch' constructor_switch.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
{% if model_switch_list.paginator %}
|
||||
{% include "pagination.html" with list=model_switch_list %}
|
||||
|
@ -41,9 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{model_switch.reference}}</td>
|
||||
<td>{{model_switch.constructor}}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'modelswitch' model_switch.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button model_switch %}
|
||||
{% can_edit model_switch %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-model-switch' model_switch.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
|
|
@ -23,9 +23,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}</th>
|
||||
|
@ -70,9 +71,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{% if not port.vlan_force %}Aucun{% else %}{{ port.vlan_force }}{% endif %}</td>
|
||||
<td>{{ port.details }}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'port' port.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button port %}
|
||||
{% can_edit port %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-port' port.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
@ -86,5 +85,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
@ -41,9 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{stack.details}}</td>
|
||||
<td>{% for switch in stack.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button stack %}
|
||||
{% can_edit stack %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
|
|
@ -23,14 +23,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
{% if switch_list.paginator %}
|
||||
{% include "pagination.html" with list=switch_list %}
|
||||
{% endif %}
|
||||
{% if switch_list.paginator %}
|
||||
{% include "pagination.html" with list=switch_list %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}</th>
|
||||
|
@ -59,7 +60,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{switch.model}}</td>
|
||||
<td>{{switch.interface_set.first.details}}</td>
|
||||
<td class="text-right">
|
||||
{% include 'buttons/history.html' with href='topologie:history' name='switch' id=switch.pk%}
|
||||
{% history_button switch %}
|
||||
{% can_edit switch %}
|
||||
{% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.pk %}
|
||||
{% acl_end %}
|
||||
|
@ -72,10 +73,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
{% if switch_list.paginator %}
|
||||
{% include "pagination.html" with list=switch_list %}
|
||||
{% endif %}
|
||||
{% if switch_list.paginator %}
|
||||
{% include "pagination.html" with list=switch_list %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
{% if switch_bay_list.paginator %}
|
||||
{% include "pagination.html" with list=switch_bay_list %}
|
||||
|
@ -45,9 +46,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{switch_bay.info}}</td>
|
||||
<td>{% for switch in switch_bay.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'switchbay' switch_bay.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button switch_bay %}
|
||||
{% can_edit switch_bay %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-switch-bay' switch_bay.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
@ -38,9 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{stack.stack_id}}</td>
|
||||
<td>{{stack.details}}</td>
|
||||
<td class="text-right">
|
||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}">
|
||||
<i class="fa fa-history"></i>
|
||||
</a>
|
||||
{% history_button stack %}
|
||||
{% can_edit stack %}
|
||||
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
|
|
@ -30,7 +30,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from django.conf.urls import url
|
||||
|
||||
import re2o
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
|
@ -51,10 +50,6 @@ urlpatterns = [
|
|||
url(r'^switch/(?P<switchid>[0-9]+)$',
|
||||
views.index_port,
|
||||
name='index-port'),
|
||||
url(r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||
re2o.views.history,
|
||||
name='history',
|
||||
kwargs={'application': 'topologie'}),
|
||||
url(r'^edit_port/(?P<portid>[0-9]+)$', views.edit_port, name='edit-port'),
|
||||
url(r'^new_port/(?P<switchid>[0-9]+)$', views.new_port, name='new-port'),
|
||||
url(r'^del_port/(?P<portid>[0-9]+)$', views.del_port, name='del-port'),
|
||||
|
|
|
@ -22,11 +22,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
{% if ban_list.paginator %}
|
||||
{% include "pagination.html" with list=ban_list %}
|
||||
{% endif %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% include "buttons/sort.html" with prefix='ban' col="user" text="Utilisateur" %}</th>
|
||||
|
@ -53,11 +54,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit ban %}
|
||||
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='users:history' name='ban' id=ban.id %}
|
||||
{% history_button ban %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
{% if ban_list.paginator %}
|
||||
{% include "pagination.html" with list=ban_list %}
|
||||
|
|
|
@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load acl %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% include "buttons/sort.html" with prefix='club' col="surname" text="Nom" %}</th>
|
||||
|
@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
</tr>
|
||||
{% acl_end %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
{% if clubs_list.paginator %}
|
||||
{% include "pagination.html" with list=clubs_list %}
|
||||
|
|
|
@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endcomment %}
|
||||
|
||||
{% load i18n %}
|
||||
{% load logs_extra %}
|
||||
|
||||
{% if superusers.count %}
|
||||
<div class="panel panel-default">
|
||||
|
@ -115,7 +116,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{{users.count}} <i class="fa fa-user"></i>
|
||||
</a>
|
||||
{% include 'buttons/edit.html' with href='users:edit-listright' id=right.id %}
|
||||
{% include 'buttons/history.html' with href='users:history' name='listright' id=right.id %}
|
||||
{% history_button right %}
|
||||
</div>
|
||||
<h4 class="{% if right.critical %}text-danger{% endif %}">
|
||||
<i class="fa fa-address-book"></i>
|
||||
|
|
|
@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
{% for right in right_list %}
|
||||
|
@ -36,6 +36,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td> {{ user_right }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
||||
|
|
|
@ -22,12 +22,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
{% if school_list.paginator %}
|
||||
{% include "pagination.html" with list=school_list %}
|
||||
{% endif %}
|
||||
{% if school_list.paginator %}
|
||||
{% include "pagination.html" with list=school_list %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<table class="table table-striped">
|
||||
|
@ -44,14 +45,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit school %}
|
||||
{% include 'buttons/edit.html' with href='users:edit-school' id=school.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='users:history' name='school' id=school.id %}
|
||||
{% history_button school %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% if school_list.paginator %}
|
||||
{% include "pagination.html" with list=school_list %}
|
||||
{% endif %}
|
||||
{% if school_list.paginator %}
|
||||
{% include "pagination.html" with list=school_list %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
{% load acl %}
|
||||
<table class="table table-striped">
|
||||
{% load logs_extra %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
|
@ -43,9 +44,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit serviceuser %}
|
||||
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %}
|
||||
{% history_button serviceuser %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
{% load acl %}
|
||||
<table class="table table-striped">
|
||||
{% load logs_extra %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Shell</th>
|
||||
|
@ -39,9 +40,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit shell %}
|
||||
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='users:history' name='listshell' id=shell.id %}
|
||||
{% history_button shell %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
{% endcomment %}
|
||||
<div class="table-responsive">
|
||||
{% if users_list.paginator %}
|
||||
{% include "pagination.html" with list=users_list %}
|
||||
{% endif %}
|
||||
{% if users_list.paginator %}
|
||||
{% include "pagination.html" with list=users_list %}
|
||||
{% endif %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
|
@ -57,7 +57,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% if users_list.paginator %}
|
||||
{% include "pagination.html" with list=users_list %}
|
||||
{% endif %}
|
||||
{% if users_list.paginator %}
|
||||
{% include "pagination.html" with list=users_list %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% include "pagination.html" with list=white_list %}
|
||||
{% endif %}
|
||||
{% load acl %}
|
||||
<table class="table table-striped">
|
||||
{% load logs_extra %}
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% include "buttons/sort.html" with prefix='white' col="user" text="Utilisateur" %}</th>
|
||||
|
@ -53,11 +54,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% can_edit whitelist %}
|
||||
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
|
||||
{% acl_end %}
|
||||
{% include 'buttons/history.html' with href='users:history' name='whitelist' id=whitelist.id %}
|
||||
{% history_button whitelist %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
{% if white_list.paginator %}
|
||||
{% include "pagination.html" with list=white_list %}
|
||||
|
|
|
@ -25,12 +25,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
|
||||
{% load bootstrap3 %}
|
||||
{% load acl %}
|
||||
{% load logs_extra %}
|
||||
{% block title %}Profil{% endblock %}
|
||||
{% block content %}
|
||||
<h2>{{ users.surname }} {{users.name}}</h2>
|
||||
<p>Vous êtes {% if users.end_adhesion != None %}<span class="label label-success">
|
||||
un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger">
|
||||
non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||
un {{ users.class_name | lower}}</span>{% else %}<span class="label label-danger">
|
||||
non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
||||
<span class="label label-success">active</span>{% else %}<span class="label label-danger">désactivée</span>{% endif %}.</p>
|
||||
{% if user_solde %}
|
||||
<p>Votre solde est de <span class="badge">{{ users.solde }}€</span>.
|
||||
|
@ -70,10 +71,7 @@ non adhérent</span>{% endif %} et votre connexion est {% if users.has_access %}
|
|||
Gérer les groupes
|
||||
</a>
|
||||
{% acl_end %}
|
||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}">
|
||||
<i class="fa fa-history"></i>
|
||||
Historique
|
||||
</a>
|
||||
{% history_button users text="History" %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
|
|
@ -27,7 +27,6 @@ from __future__ import unicode_literals
|
|||
|
||||
from django.conf.urls import url
|
||||
|
||||
import re2o
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
|
@ -95,10 +94,6 @@ urlpatterns = [
|
|||
url(r'^process/(?P<token>[a-z0-9]{32})/$', views.process, name='process'),
|
||||
url(r'^reset_password/$', views.reset_password, name='reset-password'),
|
||||
url(r'^mass_archive/$', views.mass_archive, name='mass-archive'),
|
||||
url(r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||
re2o.views.history,
|
||||
name='history',
|
||||
kwargs={'application': 'users'}),
|
||||
url(r'^$', views.index, name='index'),
|
||||
url(r'^index_clubs/$', views.index_clubs, name='index-clubs'),
|
||||
url(r'^rest/ml/std/$',
|
||||
|
|
Loading…
Reference in a new issue