From d123ce920d7231f1e3e18a769e9783d2314ec258 Mon Sep 17 00:00:00 2001 From: chirac Date: Wed, 27 Jun 2018 20:28:54 +0000 Subject: [PATCH] =?UTF-8?q?Menu=20s=C3=A9par=C3=A9=20pour=20les=20profils?= =?UTF-8?q?=20de=20ports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- topologie/templates/topologie/index.html | 10 ----- .../topologie/index_portprofile.html | 44 +++++++++++++++++++ topologie/templates/topologie/sidebar.html | 6 ++- topologie/urls.py | 3 ++ topologie/views.py | 17 +++++-- 5 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 topologie/templates/topologie/index_portprofile.html diff --git a/topologie/templates/topologie/index.html b/topologie/templates/topologie/index.html index 7902f4a3..7949f412 100644 --- a/topologie/templates/topologie/index.html +++ b/topologie/templates/topologie/index.html @@ -73,14 +73,4 @@ Topologie des Switchs

-

{% trans "Port profiles" %}

-{% can_create PortProfile %} -{% trans " Add a port profile" %} -
-{% acl_end %} - {% include "topologie/aff_port_profile.html" with port_profile_list=port_profile_list %} -
-
-
- {% endblock %} diff --git a/topologie/templates/topologie/index_portprofile.html b/topologie/templates/topologie/index_portprofile.html new file mode 100644 index 00000000..a4287da6 --- /dev/null +++ b/topologie/templates/topologie/index_portprofile.html @@ -0,0 +1,44 @@ +{% extends "topologie/sidebar.html" %} +{% comment %} +Re2o est un logiciel d'administration développé initiallement au rezometz. Il +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 + +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 +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +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 %} + +{% load bootstrap3 %} +{% load acl %} +{% load i18n %} + +{% block title %}Switchs{% endblock %} + +{% block content %} + +

{% trans "Port profiles" %}

+{% can_create PortProfile %} +{% trans " Add a port profile" %} +
+{% acl_end %} + {% include "topologie/aff_port_profile.html" with port_profile_list=port_profile_list %} +
+
+
+ +{% endblock %} diff --git a/topologie/templates/topologie/sidebar.html b/topologie/templates/topologie/sidebar.html index ce7b4114..c7ea6337 100644 --- a/topologie/templates/topologie/sidebar.html +++ b/topologie/templates/topologie/sidebar.html @@ -33,7 +33,11 @@ with this program; if not, write to the Free Software Foundation, Inc., Switchs - + + + Profil des ports switchs + + Bornes WiFi diff --git a/topologie/urls.py b/topologie/urls.py index 7cfc5714..a827acf2 100644 --- a/topologie/urls.py +++ b/topologie/urls.py @@ -113,6 +113,9 @@ urlpatterns = [ url(r'^del_building/(?P[0-9]+)$', views.del_building, name='del-building'), + url(r'^index_port_profile/$', + views.index_port_profile, + name='index-port-profile'), url(r'^new_port_profile/$', views.new_port_profile, name='new-port-profile'), diff --git a/topologie/views.py b/topologie/views.py index 4b21c651..b7761e0c 100644 --- a/topologie/views.py +++ b/topologie/views.py @@ -128,11 +128,9 @@ def index(request): SortTable.TOPOLOGIE_INDEX ) - port_profile_list = PortProfile.objects.all() pagination_number = GeneralOption.get_cached_value('pagination_number') switch_list = re2o_paginator(request, switch_list, pagination_number) - port_profile_list = re2o_paginator(request, port_profile_list, pagination_number) if any(service_link.need_regen for service_link in Service_link.objects.filter(service__service_type='graph_topo')): make_machine_graph() @@ -144,7 +142,20 @@ def index(request): return render( request, 'topologie/index.html', - {'switch_list': switch_list, 'port_profile_list': port_profile_list} + {'switch_list': switch_list} + ) + + +@login_required +@can_view_all(PortProfile) +def index_port_profile(request): + pagination_number = GeneralOption.get_cached_value('pagination_number') + port_profile_list = PortProfile.objects.all().select_related('vlan_untagged') + port_profile_list = re2o_paginator(request, port_profile_list, pagination_number) + return render( + request, + 'topologie/index_portprofile.html', + {'port_profile_list': port_profile_list} )