From 2966547b19d21b67345dcf19749fdf16c6d092d8 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Tue, 27 Mar 2018 23:56:16 +0200 Subject: [PATCH 01/14] Paginateur sur school + tableaux responsives + fix divers --- logs/views.py | 4 +++- machines/templates/machines/aff_extension.html | 5 +++-- machines/templates/machines/aff_iptype.html | 10 ++++------ machines/templates/machines/aff_vlan.html | 3 ++- re2o/utils.py | 4 ++++ topologie/models.py | 2 +- users/templates/users/aff_schools.html | 15 ++++++++++++++- users/templates/users/index_schools.html | 1 + users/views.py | 17 +++++++++++++++++ 9 files changed, 49 insertions(+), 12 deletions(-) diff --git a/logs/views.py b/logs/views.py index 6ab48706..5dd87eaa 100644 --- a/logs/views.py +++ b/logs/views.py @@ -90,7 +90,8 @@ from topologie.models import ( Room, Stack, ModelSwitch, - ConstructorSwitch + ConstructorSwitch, + AccessPoint ) from preferences.models import GeneralOption from re2o.views import form @@ -360,6 +361,7 @@ def stats_models(request): }, 'Topologie': { 'switch': [Switch.PRETTY_NAME, Switch.objects.count()], + 'bornes': [AccessPoint.PRETTY_NAME, AccessPoint.objects.count()], 'port': [Port.PRETTY_NAME, Port.objects.count()], 'chambre': [Room.PRETTY_NAME, Room.objects.count()], 'stack': [Stack.PRETTY_NAME, Stack.objects.count()], diff --git a/machines/templates/machines/aff_extension.html b/machines/templates/machines/aff_extension.html index 0da5a08e..1feec748 100644 --- a/machines/templates/machines/aff_extension.html +++ b/machines/templates/machines/aff_extension.html @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load acl %} +
@@ -38,7 +39,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for extension in extension_list %} - + @@ -55,4 +56,4 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endfor %}
{{ extension.name }} {{ extension.need_infra }} {{ extension.soa}}
- +
diff --git a/machines/templates/machines/aff_iptype.html b/machines/templates/machines/aff_iptype.html index c5ed4c10..1a76e303 100644 --- a/machines/templates/machines/aff_iptype.html +++ b/machines/templates/machines/aff_iptype.html @@ -23,15 +23,14 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endcomment %} {% load acl %} - +
- - + @@ -44,8 +43,7 @@ with this program; if not, write to the Free Software Foundation, Inc., - - + @@ -58,4 +56,4 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endfor %}
Type d'ip Extension Nécessite l'autorisation infraDébutFinPlage ipv4 Préfixe v6 Sur vlan Ouverture ports par défault{{ type.type }} {{ type.extension }} {{ type.need_infra }}{{ type.domaine_ip_start }}{{ type.domaine_ip_stop }}{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }} {{ type.prefix_v6 }} {{ type.vlan }} {{ type.ouverture_ports }}
- +
diff --git a/machines/templates/machines/aff_vlan.html b/machines/templates/machines/aff_vlan.html index deb8cb11..2e3d99b4 100644 --- a/machines/templates/machines/aff_vlan.html +++ b/machines/templates/machines/aff_vlan.html @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% load acl %} +
@@ -49,4 +50,4 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endfor %}
- +
diff --git a/re2o/utils.py b/re2o/utils.py index 32be2432..aaefca8d 100644 --- a/re2o/utils.py +++ b/re2o/utils.py @@ -190,6 +190,10 @@ class SortTable: 'white_end': ['date_end'], 'default': ['-date_end'] } + USERS_INDEX_SCHOOL = { + 'school_name': ['name'], + 'default': ['name'] + } MACHINES_INDEX = { 'machine_name': ['name'], 'default': ['pk'] diff --git a/topologie/models.py b/topologie/models.py index 22c0192d..ba40626f 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -47,7 +47,7 @@ from django.db import IntegrityError from django.db import transaction from reversion import revisions as reversion -from machines.models import Machine, Interface +from machines.models import Machine, Interface, regen class Stack(models.Model): """Un objet stack. Regrouppe des switchs en foreign key diff --git a/users/templates/users/aff_schools.html b/users/templates/users/aff_schools.html index 64d92cd1..260c7ef3 100644 --- a/users/templates/users/aff_schools.html +++ b/users/templates/users/aff_schools.html @@ -22,10 +22,18 @@ 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 %} + +
+ +{% if school_list.paginator %} +{% include "pagination.html" with list=school_list %} +{% endif %} + + - + @@ -42,3 +50,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endfor %}
Etablissement{% include "buttons/sort.html" with prefix='school' col='name' text='Etablissement' %}
+{% if school_list.paginator %} +{% include "pagination.html" with list=school_list %} +{% endif %} +
+ diff --git a/users/templates/users/index_schools.html b/users/templates/users/index_schools.html index 93bb0737..0912ffd5 100644 --- a/users/templates/users/index_schools.html +++ b/users/templates/users/index_schools.html @@ -35,6 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc., Ajouter un établissement {% acl_end %} Supprimer un ou plusieurs établissements +
{% include "users/aff_schools.html" with school_list=school_list %}

diff --git a/users/views.py b/users/views.py index a0d46fe8..e1bf5985 100644 --- a/users/views.py +++ b/users/views.py @@ -747,6 +747,23 @@ def index_white(request): def index_school(request): """ Affiche l'ensemble des établissement""" school_list = School.objects.order_by('name') + pagination_number = GeneralOption.get_cached_value('pagination_number') + school_list = SortTable.sort( + school_list, + request.GET.get('col'), + request.GET.get('order'), + SortTable.USERS_INDEX_SCHOOL + ) + paginator = Paginator(school_list, pagination_number) + page = request.GET.get('page') + try: + school_list = paginator.page(page) + except PageNotAnInteger: + # If page isn't an integer, deliver first page + school_list = paginator.page(1) + except EmptyPage: + # If page is out of range (e.g. 9999), deliver last page of results. + school_list = paginator.page(paginator.num_pages) return render( request, 'users/index_schools.html', From e3830a60998ce52214296cf076fbb9ff9ff1b2ba Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Wed, 28 Mar 2018 00:10:10 +0200 Subject: [PATCH 02/14] Nouveaux dropdown dans la bar --- templates/base.html | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/templates/base.html b/templates/base.html index 740881bf..6961e583 100644 --- a/templates/base.html +++ b/templates/base.html @@ -83,9 +83,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,