8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-03 18:12:24 +00:00

fix #65, gestion propre de l'historique.

This commit is contained in:
Hugo LEVY-FALK 2018-07-19 12:30:15 +02:00
parent cfa6fe097d
commit 6b945bf322
51 changed files with 1218 additions and 1279 deletions

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -51,9 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'article' article.id %}"> {% history_button article %}
<i class="fa fa-history"></i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -41,9 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'banque' banque.id %}"> {% history_button banque %}
<i class="fa fa-history"></i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if facture_list.paginator %} {% if facture_list.paginator %}
@ -86,9 +87,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</li> </li>
{% acl_end %} {% acl_end %}
<li> <li>
<a href="{% url 'cotisations:history' 'facture' facture.id %}"> {% history_button facture text='History' html_class=''%}
<i class="fa fa-history"></i> {% trans "Historique" %}
</a>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load acl %} {% load acl %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -47,9 +48,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-info btn-sm" role="button" title="{% trans "Historique" %}" href="{% url 'cotisations:history' 'paiement' paiement.id %}"> {% history_button paiement %}
<i class="fa fa-history"></i>
</a>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
from . import payment_methods from . import payment_methods
@ -122,12 +121,6 @@ urlpatterns = [
views.index_paiement, views.index_paiement,
name='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( url(
r'^control/$', r'^control/$',
views.control, views.control,

View file

@ -33,3 +33,15 @@ register = template.Library()
def classname(obj): def classname(obj):
""" Returns the object class name """ """ Returns the object class name """
return obj.__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,
}

View file

@ -39,4 +39,9 @@ urlpatterns = [
url(r'^stats_models/$', views.stats_models, name='stats-models'), url(r'^stats_models/$', views.stats_models, name='stats-models'),
url(r'^stats_users/$', views.stats_users, name='stats-users'), url(r'^stats_users/$', views.stats_users, name='stats-users'),
url(r'^stats_actions/$', views.stats_actions, name='stats-actions'), 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 # se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics. # quelques clics.
# #
# Copyright © 2017 Gabriel Détraz # Copyright © 2018 Gabriel Détraz
# Copyright © 2017 Goulven Kermarec # Copyright © 2018 Goulven Kermarec
# Copyright © 2017 Augustin Lemesle # Copyright © 2018 Augustin Lemesle
# Copyright © 2018 Hugo Levy-Falk
# #
# This program is free software; you can redistribute it and/or modify # 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 # 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 __future__ import unicode_literals
from itertools import chain
from django.urls import reverse from django.urls import reverse
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.db.models import Count, Max, F from django.db.models import Count, Max, F
from django.apps import apps
from reversion.models import Revision from reversion.models import Revision
from reversion.models import Version, ContentType from reversion.models import Version, ContentType
@ -453,3 +457,61 @@ def stats_actions(request):
}, },
} }
return render(request, 'logs/stats_users.html', {'stats_list': stats}) 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}
)

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -38,7 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit alias %} {% can_edit alias %}
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %} {% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='domain' id=alias.id %} {% history_button alias %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
@ -51,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit extension %} {% can_edit extension %}
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %} {% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='extension' id=extension.id %} {% history_button extension %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -51,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit type %} {% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %} {% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='iptype' id=type.id %} {% history_button type %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -43,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_delete ipv6 %} {% can_delete ipv6 %}
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %} {% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='ipv6list' id=ipv6.id %} {% history_button ipv6 %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if machines_list.paginator %} {% 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 %} {% can_create Interface machine.id %}
{% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc='Ajouter une interface' %} {% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc='Ajouter une interface' %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='machine' id=machine.id %} {% history_button machine %}
{% can_delete machine %} {% can_delete machine %}
{% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %} {% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %}
{% acl_end %} {% acl_end %}
@ -127,7 +128,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %} {% acl_end %}
</ul> </ul>
</div> </div>
{% include 'buttons/history.html' with href='machines:history' name='interface' id=interface.id %} {% history_button interface %}
{% can_delete interface %} {% can_delete interface %}
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %} {% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
{% acl_end %} {% acl_end %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -40,7 +41,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit type %} {% can_edit type %}
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %} {% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='machinetype' id=type.id %} {% history_button type %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -43,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit mx %} {% can_edit mx %}
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %} {% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='mx' id=mx.id %} {% history_button mx %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -46,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit nas %} {% can_edit nas %}
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %} {% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='nas' id=nas.id %} {% history_button nas %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -41,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit ns %} {% can_edit ns %}
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %} {% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='ns' id=ns.id %} {% history_button ns %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -45,7 +46,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit service %} {% can_edit service %}
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %} {% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='service' id=service.id %} {% history_button service %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -49,7 +50,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit soa %} {% can_edit soa %}
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %} {% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='soa' id=soa.id %} {% history_button soa %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -53,7 +54,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit srv %} {% can_edit srv %}
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %} {% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='srv' id=srv.id %} {% history_button srv %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -41,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit txt %} {% can_edit txt %}
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %} {% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='txt' id=txt.id %} {% history_button txt %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
@ -45,7 +46,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit vlan %} {% can_edit vlan %}
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %} {% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='machines:history' name='vlan' id=vlan.id %} {% history_button vlan %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -27,7 +27,6 @@ The defined URLs for the Cotisations app
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
urlpatterns = [ urlpatterns = [
@ -119,10 +118,6 @@ urlpatterns = [
url(r'^edit_nas/(?P<nasid>[0-9]+)$', views.edit_nas, name='edit-nas'), 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'^del_nas/$', views.del_nas, name='del-nas'),
url(r'^index_nas/$', views.index_nas, name='index-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'^$', views.index, name='index'),
url(r'^rest/mac-ip/$', views.mac_ip, name='mac-ip'), url(r'^rest/mac-ip/$', views.mac_ip, name='mac-ip'),
url(r'^rest/regen-achieved/$', 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. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -43,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit service%} {% can_edit service%}
{% include 'buttons/edit.html' with href='preferences:edit-service' id=service.id %} {% include 'buttons/edit.html' with href='preferences:edit-service' id=service.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='preferences:history' name='service' id=service.id %} {% history_button service %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
@ -74,11 +73,5 @@ urlpatterns = [
name='edit-service' name='edit-service'
), ),
url(r'^del_services/$', views.del_services, name='del-services'), 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'), url(r'^$', views.display_options, name='display-options'),
] ]

View file

@ -26,33 +26,20 @@ les views
from __future__ import unicode_literals from __future__ import unicode_literals
from itertools import chain
import git import git
from reversion.models import Version
from django.http import Http404 from django.shortcuts import render
from django.urls import reverse
from django.shortcuts import render, redirect
from django.template.context_processors import csrf 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.conf import settings
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.views.decorators.cache import cache_page from django.views.decorators.cache import cache_page
import preferences
from preferences.models import ( from preferences.models import (
Service, Service,
GeneralOption,
AssoOption, AssoOption,
HomeOption HomeOption
) )
import users
import cotisations
import topologie
import machines
from .utils import re2o_paginator
from .contributors import CONTRIBUTORS from .contributors import CONTRIBUTORS
@ -81,112 +68,6 @@ def index(request):
}, 're2o/index.html', 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) @cache_page(7 * 24 * 60 * 60)
def about_page(request): def about_page(request):
""" The view for the about page. """ 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., with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url href name id %}"> {% load i18n %}
<i class="fa fa-history"></i> <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> </a>

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if ap_list.paginator %} {% 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.interface_set.first.details}}</td>
<td>{{ap.location}}</td> <td>{{ap.location}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'accesspoint' ap.pk %}"> {% history_button ap %}
<i class="fa fa-history"></i>
</a>
{% can_edit ap %} {% can_edit ap %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-ap' ap.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-ap' ap.id %}">
<i class="fa fa-edit"></i> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if building_list.paginator %} {% if building_list.paginator %}
{% include "pagination.html" with list=building_list %} {% include "pagination.html" with list=building_list %}
@ -39,9 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr> <tr>
<td>{{building.name}}</td> <td>{{building.name}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'building' building.pk %}"> {% history_button building %}
<i class="fa fa-history"></i>
</a>
{% can_edit building %} {% can_edit building %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-building' building.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-building' building.id %}">
<i class="fa fa-edit"></i> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if room_list.paginator %} {% if room_list.paginator %}
{% include "pagination.html" with list=room_list %} {% 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.name}}</td>
<td>{{room.details}}</td> <td>{{room.details}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'room' room.pk %}"> {% history_button room %}
<i class="fa fa-history"></i>
</a>
{% can_edit room %} {% can_edit room %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-room' room.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-room' room.id %}">
<i class="fa fa-edit"></i> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if constructor_switch_list.paginator %} {% if constructor_switch_list.paginator %}
{% include "pagination.html" with list=constructor_switch_list %} {% 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> <tr>
<td>{{constructor_switch}}</td> <td>{{constructor_switch}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'constructorswitch' constructor_switch.pk %}"> {% history_button constructor_switch %}
<i class="fa fa-history"></i>
</a>
{% can_edit 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 %}"> <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> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if model_switch_list.paginator %} {% if model_switch_list.paginator %}
{% include "pagination.html" with list=model_switch_list %} {% 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.reference}}</td>
<td>{{model_switch.constructor}}</td> <td>{{model_switch.constructor}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'modelswitch' model_switch.pk %}"> {% history_button model_switch %}
<i class="fa fa-history"></i>
</a>
{% can_edit 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 %}"> <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> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <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>{% if not port.vlan_force %}Aucun{% else %}{{ port.vlan_force }}{% endif %}</td>
<td>{{ port.details }}</td> <td>{{ port.details }}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'port' port.pk %}"> {% history_button port %}
<i class="fa fa-history"></i>
</a>
{% can_edit port %} {% can_edit port %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-port' port.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-port' port.id %}">
<i class="fa fa-edit"></i> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -41,9 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{stack.details}}</td> <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>{% for switch in stack.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}"> {% history_button stack %}
<i class="fa fa-history"></i>
</a>
{% can_edit stack %} {% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<i class="fa fa-edit"></i> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
{% if switch_list.paginator %} {% 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.model}}</td>
<td>{{switch.interface_set.first.details}}</td> <td>{{switch.interface_set.first.details}}</td>
<td class="text-right"> <td class="text-right">
{% include 'buttons/history.html' with href='topologie:history' name='switch' id=switch.pk%} {% history_button switch %}
{% can_edit switch %} {% can_edit switch %}
{% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.pk %} {% include 'buttons/edit.html' with href='topologie:edit-switch' id=switch.pk %}
{% acl_end %} {% acl_end %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if switch_bay_list.paginator %} {% if switch_bay_list.paginator %}
{% include "pagination.html" with list=switch_bay_list %} {% 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>{{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>{% for switch in switch_bay.switch_set.all %}<a href="{% url 'topologie:index-port' switch.pk %}">{{switch }} </a>{% endfor %}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'switchbay' switch_bay.pk %}"> {% history_button switch_bay %}
<i class="fa fa-history"></i>
</a>
{% can_edit 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 %}"> <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> <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 %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
@ -38,9 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{stack.stack_id}}</td> <td>{{stack.stack_id}}</td>
<td>{{stack.details}}</td> <td>{{stack.details}}</td>
<td class="text-right"> <td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'stack' stack.pk %}"> {% history_button stack %}
<i class="fa fa-history"></i>
</a>
{% can_edit stack %} {% can_edit stack %}
<a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}"> <a class="btn btn-primary btn-sm" role="button" title="Éditer" href="{% url 'topologie:edit-stack' stack.id %}">
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>

View file

@ -30,7 +30,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
urlpatterns = [ urlpatterns = [
@ -51,10 +50,6 @@ urlpatterns = [
url(r'^switch/(?P<switchid>[0-9]+)$', url(r'^switch/(?P<switchid>[0-9]+)$',
views.index_port, views.index_port,
name='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'^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'^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'), 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. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% if ban_list.paginator %} {% if ban_list.paginator %}
{% include "pagination.html" with list=ban_list %} {% include "pagination.html" with list=ban_list %}
{% endif %} {% endif %}
@ -53,7 +54,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit ban %} {% can_edit ban %}
{% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %} {% include 'buttons/edit.html' with href='users:edit-ban' id=ban.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='ban' id=ban.id %} {% history_button ban %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endcomment %} {% endcomment %}
{% load i18n %} {% load i18n %}
{% load logs_extra %}
{% if superusers.count %} {% if superusers.count %}
<div class="panel panel-default"> <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> {{users.count}} <i class="fa fa-user"></i>
</a> </a>
{% include 'buttons/edit.html' with href='users:edit-listright' id=right.id %} {% 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> </div>
<h4 class="{% if right.critical %}text-danger{% endif %}"> <h4 class="{% if right.critical %}text-danger{% endif %}">
<i class="fa fa-address-book"></i> <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. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<div class="table-responsive"> <div class="table-responsive">
@ -44,7 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit school %} {% can_edit school %}
{% include 'buttons/edit.html' with href='users:edit-school' id=school.id %} {% include 'buttons/edit.html' with href='users:edit-school' id=school.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='school' id=school.id %} {% history_button school %}
</td> </td>
</tr> </tr>
{% endfor %} {% 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. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -43,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit serviceuser %} {% can_edit serviceuser %}
{% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %} {% include 'buttons/edit.html' with href='users:edit-serviceuser' id=serviceuser.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='serviceuser' id=serviceuser.id %} {% history_button serviceuser %}
</td> </td>
</tr> </tr>
{% endfor %} {% 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. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
{% endcomment %} {% endcomment %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -39,7 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit shell %} {% can_edit shell %}
{% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %} {% include 'buttons/edit.html' with href='users:edit-shell' id=shell.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='listshell' id=shell.id %} {% history_button shell %}
</td> </td>
</tr> </tr>
{% endfor %} {% 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 %} {% include "pagination.html" with list=white_list %}
{% endif %} {% endif %}
{% load acl %} {% load acl %}
{% load logs_extra %}
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
@ -53,7 +54,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_edit whitelist %} {% can_edit whitelist %}
{% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %} {% include 'buttons/edit.html' with href='users:edit-whitelist' id=whitelist.id %}
{% acl_end %} {% acl_end %}
{% include 'buttons/history.html' with href='users:history' name='whitelist' id=whitelist.id %} {% history_button whitelist %}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% load bootstrap3 %} {% load bootstrap3 %}
{% load acl %} {% load acl %}
{% load logs_extra %}
{% block title %}Profil{% endblock %} {% block title %}Profil{% endblock %}
{% block content %} {% block content %}
<h2>{{ users.surname }} {{users.name}}</h2> <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 Gérer les groupes
</a> </a>
{% acl_end %} {% acl_end %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'users:history' 'user' users.id %}"> {% history_button users text="History" %}
<i class="fa fa-history"></i>
Historique
</a>
</ul> </ul>
</div> </div>
<div class="panel-body"> <div class="panel-body">

View file

@ -27,7 +27,6 @@ from __future__ import unicode_literals
from django.conf.urls import url from django.conf.urls import url
import re2o
from . import views from . import views
urlpatterns = [ urlpatterns = [
@ -95,10 +94,6 @@ urlpatterns = [
url(r'^process/(?P<token>[a-z0-9]{32})/$', views.process, name='process'), 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'^reset_password/$', views.reset_password, name='reset-password'),
url(r'^mass_archive/$', views.mass_archive, name='mass-archive'), 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'^$', views.index, name='index'),
url(r'^index_clubs/$', views.index_clubs, name='index-clubs'), url(r'^index_clubs/$', views.index_clubs, name='index-clubs'),
url(r'^rest/ml/std/$', url(r'^rest/ml/std/$',