diff --git a/topologie/templates/topologie/index_model_switch.html b/topologie/templates/topologie/index_model_switch.html
index 19752b2a..7c1a15f8 100644
--- a/topologie/templates/topologie/index_model_switch.html
+++ b/topologie/templates/topologie/index_model_switch.html
@@ -29,31 +29,21 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}Modèles de switches{% endblock %}
{% block content %}
-
Modèles de switches
-{% can_create ModelSwitch %}
- Ajouter un modèle
-
-{% acl_end %}
-{% include "topologie/aff_model_switch.html" with model_switch_list=model_switch_list %}
-Constructeurs de switches
-{% can_create ConstructorSwitch %}
- Ajouter un constructeur
-
-{% acl_end %}
-{% include "topologie/aff_constructor_switch.html" with constructor_switch_list=constructor_switch_list %}
-Baie de brassage
-{% can_create SwitchBay %}
- Ajouter une baie de brassage
-
-{% acl_end %}
-{% include "topologie/aff_switch_bay.html" with switch_bay_list=switch_bay_list %}
-Batiment
-{% can_create Building %}
- Ajouter un bâtiment
-
-{% acl_end %}
-{% include "topologie/aff_building.html" with building_list=building_list %}
-
-
-
+ Modèles de switches
+ {% can_create ModelSwitch %}
+
+ Ajouter un modèle
+
+
+ {% acl_end %}
+ {% include "topologie/aff_model_switch.html" with model_switch_list=model_switch_list %}
+
+ Constructeurs de switches
+ {% can_create ConstructorSwitch %}
+
+ Ajouter un constructeur
+
+
+ {% acl_end %}
+ {% include "topologie/aff_constructor_switch.html" with constructor_switch_list=constructor_switch_list %}
{% endblock %}
diff --git a/topologie/templates/topologie/index_stack.html b/topologie/templates/topologie/index_stack.html
index 1ba49b5a..2470c019 100644
--- a/topologie/templates/topologie/index_stack.html
+++ b/topologie/templates/topologie/index_stack.html
@@ -29,12 +29,29 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}Stacks{% endblock %}
{% block content %}
- Stacks
-{% can_create Stack %}
- Ajouter une stack
-{% acl_end %}
+ Stacks
+ {% can_create Stack %}
+
+ Ajouter une stack
+
+ {% acl_end %}
{% include "topologie/aff_stacks.html" with stack_list=stack_list %}
-
-
-
+
+ Baie de brassage
+ {% can_create SwitchBay %}
+
+ Ajouter une baie de brassage
+
+
+ {% acl_end %}
+ {% include "topologie/aff_switch_bay.html" with switch_bay_list=switch_bay_list %}
+
+ Batiment
+ {% can_create Building %}
+
+ Ajouter un bâtiment
+
+
+ {% acl_end %}
+ {% include "topologie/aff_building.html" with building_list=building_list %}
{% endblock %}
diff --git a/topologie/views.py b/topologie/views.py
index 51c00aa8..3a215c07 100644
--- a/topologie/views.py
+++ b/topologie/views.py
@@ -182,42 +182,20 @@ def index_ap(request):
@login_required
@can_view_all(Stack)
+@can_view_all(Building)
+@can_view_all(SwitchBay)
def index_stack(request):
"""Affichage de la liste des stacks (affiche l'ensemble des switches)"""
stack_list = Stack.objects\
.prefetch_related('switch_set__interface_set__domain__extension')
+ building_list = Building.objects.all()
+ switch_bay_list = SwitchBay.objects.select_related('building')
stack_list = SortTable.sort(
stack_list,
request.GET.get('col'),
request.GET.get('order'),
SortTable.TOPOLOGIE_INDEX_STACK
)
- return render(request, 'topologie/index_stack.html', {
- 'stack_list': stack_list
- })
-
-
-@login_required
-@can_view_all(ModelSwitch)
-@can_view_all(ConstructorSwitch)
-def index_model_switch(request):
- """ Affichage de l'ensemble des modèles de switches"""
- model_switch_list = ModelSwitch.objects.select_related('constructor')
- constructor_switch_list = ConstructorSwitch.objects
- switch_bay_list = SwitchBay.objects.select_related('building')
- building_list = Building.objects.all()
- model_switch_list = SortTable.sort(
- model_switch_list,
- request.GET.get('col'),
- request.GET.get('order'),
- SortTable.TOPOLOGIE_INDEX_MODEL_SWITCH
- )
- constructor_switch_list = SortTable.sort(
- constructor_switch_list,
- request.GET.get('col'),
- request.GET.get('order'),
- SortTable.TOPOLOGIE_INDEX_CONSTRUCTOR_SWITCH
- )
building_list = SortTable.sort(
building_list,
request.GET.get('col'),
@@ -230,11 +208,35 @@ def index_model_switch(request):
request.GET.get('order'),
SortTable.TOPOLOGIE_INDEX_SWITCH_BAY
)
+ return render(request, 'topologie/index_stack.html', {
+ 'stack_list': stack_list,
+ 'switch_bay_list': switch_bay_list,
+ 'building_list' : building_list,
+ })
+
+
+@login_required
+@can_view_all(ModelSwitch)
+@can_view_all(ConstructorSwitch)
+def index_model_switch(request):
+ """ Affichage de l'ensemble des modèles de switches"""
+ model_switch_list = ModelSwitch.objects.select_related('constructor')
+ constructor_switch_list = ConstructorSwitch.objects
+ model_switch_list = SortTable.sort(
+ model_switch_list,
+ request.GET.get('col'),
+ request.GET.get('order'),
+ SortTable.TOPOLOGIE_INDEX_MODEL_SWITCH
+ )
+ constructor_switch_list = SortTable.sort(
+ constructor_switch_list,
+ request.GET.get('col'),
+ request.GET.get('order'),
+ SortTable.TOPOLOGIE_INDEX_CONSTRUCTOR_SWITCH
+ )
return render(request, 'topologie/index_model_switch.html', {
'model_switch_list': model_switch_list,
'constructor_switch_list': constructor_switch_list,
- 'switch_bay_list': switch_bay_list,
- 'building_list' : building_list,
})