8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 04:43:10 +00:00

Merge branch 'fix_65_history' into 'master'

fix #65, gestion propre de l'historique.

Closes #65

See merge request federez/re2o!186
This commit is contained in:
chirac 2018-07-22 22:22:19 +02:00
commit a84e8b5575
51 changed files with 1228 additions and 1283 deletions

View file

@ -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 %}

View file

@ -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 %}

View file

@ -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=True html_class=False%}
</li>
</ul>
</div>

View file

@ -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 %}

View file

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

View file

@ -33,3 +33,23 @@ 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=False, html_class=True):
"""Creates the correct history button for an instance.
Args:
instance: The instance of which you want to get history buttons.
text: Flag stating if a 'History' text should be displayed.
html_class: Flag stating if the link should have the html classes
allowing it to be displayed as a button.
"""
return {
'application': instance._meta.app_label,
'name': instance._meta.model_name,
'id': instance.id,
'text': text,
'class': html_class,
}

View file

@ -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',
),
]

View file

@ -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,16 @@ 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.db.models import Count, Max, F
from django.http import Http404
from django.db.models import Count
from django.apps import apps
from django.utils.translation import ugettext as _
from reversion.models import Revision
from reversion.models import Version, ContentType
@ -453,3 +458,58 @@ 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(_("No model found."))
object_name_id = object_name + 'id'
kwargs = {object_name_id: object_id}
try:
instance = model.get_instance(**kwargs)
except model.DoesNotExist:
messages.error(request, _("No entry found."))
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 _("You cannot acces to this 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}
)

View file

@ -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,7 +39,7 @@ 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 %}

View file

@ -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 %}

View file

@ -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 %}

View file

@ -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>
@ -43,7 +44,7 @@ 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 %}

View file

@ -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 machines_list.paginator %}
@ -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 %}

View file

@ -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>
@ -40,7 +41,7 @@ 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 %}

View file

@ -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>
@ -43,7 +44,7 @@ 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 %}

View file

@ -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>
@ -46,7 +47,7 @@ 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 %}

View file

@ -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,7 +42,7 @@ 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 %}

View file

@ -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>
@ -45,7 +46,7 @@ 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 %}

View file

@ -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>
@ -49,7 +50,7 @@ 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 %}

View file

@ -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>
@ -53,7 +54,7 @@ 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 %}

View file

@ -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,7 +42,7 @@ 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 %}

View file

@ -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 %}

View file

@ -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/$',

View file

@ -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 %}

View file

@ -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'),
]

View file

@ -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
@ -81,112 +68,6 @@ def index(request):
}, '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.

View file

@ -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 {% if class%}class="btn btn-info btn-sm"{% endif %} role="button" title="{% trans 'History' %}" href="{% url 'logs:history' application name id %}">
<i class="fa fa-history"></i> {% if text %}{% trans 'History' %}{% endif %}
</a>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 switch_list.paginator %}
@ -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 %}

View file

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

View file

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

View file

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

View file

@ -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 %}
{% if ban_list.paginator %}
{% include "pagination.html" with list=ban_list %}
{% endif %}
@ -53,7 +54,7 @@ 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 %}

View file

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

View file

@ -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 %}
<div class="table-responsive">
@ -44,7 +45,7 @@ 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 %}

View file

@ -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 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 %}

View file

@ -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>
@ -39,7 +40,7 @@ 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 %}

View file

@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "pagination.html" with list=white_list %}
{% endif %}
{% load acl %}
{% load logs_extra %}
<table class="table table-striped">
<thead>
<tr>
@ -53,7 +54,7 @@ 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 %}

View file

@ -25,6 +25,7 @@ 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>
@ -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=True %}
</ul>
</div>
<div class="panel-body">

View file

@ -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/$',