mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Discrimination de l'historique par application.
This commit is contained in:
parent
783c662e39
commit
a24d2c26c0
6 changed files with 51 additions and 36 deletions
|
@ -104,6 +104,7 @@ urlpatterns = [
|
||||||
r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||||
re2o.views.history,
|
re2o.views.history,
|
||||||
name='history',
|
name='history',
|
||||||
|
kwargs={'application':'cotisations'},
|
||||||
),
|
),
|
||||||
url(r'^control/$',
|
url(r'^control/$',
|
||||||
views.control,
|
views.control,
|
||||||
|
|
|
@ -80,6 +80,7 @@ urlpatterns = [
|
||||||
r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
r'history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||||
re2o.views.history,
|
re2o.views.history,
|
||||||
name='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'),
|
||||||
|
|
|
@ -72,7 +72,8 @@ urlpatterns = [
|
||||||
url(
|
url(
|
||||||
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||||
re2o.views.history,
|
re2o.views.history,
|
||||||
name='history'
|
name='history',
|
||||||
|
kwargs={'application':'preferences'},
|
||||||
),
|
),
|
||||||
url(r'^$', views.display_options, name='display-options'),
|
url(r'^$', views.display_options, name='display-options'),
|
||||||
]
|
]
|
||||||
|
|
|
@ -54,41 +54,51 @@ def index(request):
|
||||||
|
|
||||||
#: Binding the corresponding char sequence of history url to re2o models.
|
#: Binding the corresponding char sequence of history url to re2o models.
|
||||||
HISTORY_BIND = {
|
HISTORY_BIND = {
|
||||||
'user' : users.models.User,
|
'users' : {
|
||||||
'ban' : users.models.Ban,
|
'user' : users.models.User,
|
||||||
'whitelist' : users.models.Whitelist,
|
'ban' : users.models.Ban,
|
||||||
'school' : users.models.School,
|
'whitelist' : users.models.Whitelist,
|
||||||
'listright' : users.models.ListRight,
|
'school' : users.models.School,
|
||||||
'serviceuser' : users.models.ServiceUser,
|
'listright' : users.models.ListRight,
|
||||||
'service' : preferences.models.Service,
|
'serviceuser' : users.models.ServiceUser,
|
||||||
'facture' : cotisations.models.Facture,
|
},
|
||||||
'article' : cotisations.models.Article,
|
'preferences' : {
|
||||||
'paiement' : cotisations.models.Paiement,
|
'service' : preferences.models.Service,
|
||||||
'banque' : cotisations.models.Banque,
|
},
|
||||||
'switch' : topologie.models.Switch,
|
'cotisations' : {
|
||||||
'port' : topologie.models.Port,
|
'facture' : cotisations.models.Facture,
|
||||||
'room' : topologie.models.Room,
|
'article' : cotisations.models.Article,
|
||||||
'stack' : topologie.models.Stack,
|
'paiement' : cotisations.models.Paiement,
|
||||||
'model_switch' : topologie.models.ModelSwitch,
|
'banque' : cotisations.models.Banque,
|
||||||
'constructor_switch' : topologie.models.ConstructorSwitch,
|
},
|
||||||
'machine' : machines.models.Machine,
|
'topologie' : {
|
||||||
'interface' : machines.models.Interface,
|
'switch' : topologie.models.Switch,
|
||||||
'alias' : machines.models.Domain,
|
'port' : topologie.models.Port,
|
||||||
'machinetype' : machines.models.MachineType,
|
'room' : topologie.models.Room,
|
||||||
'iptype' : machines.models.IpType,
|
'stack' : topologie.models.Stack,
|
||||||
'extension' : machines.models.Extension,
|
'model_switch' : topologie.models.ModelSwitch,
|
||||||
'soa' : machines.models.SOA,
|
'constructor_switch' : topologie.models.ConstructorSwitch,
|
||||||
'mx' : machines.models.Mx,
|
},
|
||||||
'txt' : machines.models.Txt,
|
'machines' : {
|
||||||
'srv' : machines.models.Srv,
|
'machine' : machines.models.Machine,
|
||||||
'ns' : machines.models.Ns,
|
'interface' : machines.models.Interface,
|
||||||
'service' : machines.models.Service,
|
'alias' : machines.models.Domain,
|
||||||
'vlan' : machines.models.Vlan,
|
'machinetype' : machines.models.MachineType,
|
||||||
'nas' : machines.models.Vlan,
|
'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.Vlan,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def history(request, object_name, object_id):
|
def history(request, application, object_name, object_id):
|
||||||
"""Render history for a model.
|
"""Render history for a model.
|
||||||
|
|
||||||
The model is determined using the `HISTORY_BIND` dictionnary if none is
|
The model is determined using the `HISTORY_BIND` dictionnary if none is
|
||||||
|
@ -108,7 +118,7 @@ def history(request, object_name, object_id):
|
||||||
Http404: This kind of models doesn't have history.
|
Http404: This kind of models doesn't have history.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
model = HISTORY_BIND[object_name]
|
model = HISTORY_BIND[application][object_name]
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
|
raise Http404(u"Il n'existe pas d'historique pour ce modèle.")
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -49,7 +49,8 @@ urlpatterns = [
|
||||||
url(
|
url(
|
||||||
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||||
re2o.views.history,
|
re2o.views.history,
|
||||||
name='history'
|
name='history',
|
||||||
|
kwargs={'application':'topologie'},
|
||||||
),
|
),
|
||||||
url(r'^edit_port/(?P<port_id>[0-9]+)$', views.edit_port, name='edit-port'),
|
url(r'^edit_port/(?P<port_id>[0-9]+)$', views.edit_port, name='edit-port'),
|
||||||
url(r'^new_port/(?P<switch_id>[0-9]+)$', views.new_port, name='new-port'),
|
url(r'^new_port/(?P<switch_id>[0-9]+)$', views.new_port, name='new-port'),
|
||||||
|
|
|
@ -97,7 +97,8 @@ urlpatterns = [
|
||||||
url(
|
url(
|
||||||
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
r'^history/(?P<object_name>\w+)/(?P<object_id>[0-9]+)$',
|
||||||
re2o.views.history,
|
re2o.views.history,
|
||||||
name='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'),
|
||||||
|
|
Loading…
Reference in a new issue