From c029feeca5745fac2cd9acfefab8722ee05930d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Sun, 22 Oct 2017 15:48:35 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20prefix=20sur=20tous=20les=20tablea?= =?UTF-8?q?ux=20pour=20les=20diff=C3=A9rencier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cotisations/aff_cotisations.html | 6 +- .../templates/cotisations/control.html | 12 +-- logs/templates/logs/aff_stats_logs.html | 4 +- logs/templates/logs/aff_summary.html | 2 +- machines/templates/machines/aff_machines.html | 2 +- re2o/utils.py | 74 +++++++++---------- templates/buttons/sort.html | 11 +++ .../templates/topologie/aff_chambres.html | 2 +- topologie/templates/topologie/aff_port.html | 12 +-- topologie/templates/topologie/aff_stacks.html | 4 +- topologie/templates/topologie/aff_switch.html | 10 +-- users/templates/users/aff_bans.html | 6 +- users/templates/users/aff_users.html | 8 +- users/templates/users/aff_whitelists.html | 6 +- 14 files changed, 85 insertions(+), 74 deletions(-) diff --git a/cotisations/templates/cotisations/aff_cotisations.html b/cotisations/templates/cotisations/aff_cotisations.html index b9548a74..59d558bf 100644 --- a/cotisations/templates/cotisations/aff_cotisations.html +++ b/cotisations/templates/cotisations/aff_cotisations.html @@ -29,11 +29,11 @@ with this program; if not, write to the Free Software Foundation, Inc., - + - - + + diff --git a/cotisations/templates/cotisations/control.html b/cotisations/templates/cotisations/control.html index 3282e29e..461494dd 100644 --- a/cotisations/templates/cotisations/control.html +++ b/cotisations/templates/cotisations/control.html @@ -40,14 +40,14 @@ with this program; if not, write to the Free Software Foundation, Inc., - - + + - - - - + + + + {% for form in controlform.forms %} diff --git a/logs/templates/logs/aff_stats_logs.html b/logs/templates/logs/aff_stats_logs.html index b0fa2b14..71efb147 100644 --- a/logs/templates/logs/aff_stats_logs.html +++ b/logs/templates/logs/aff_stats_logs.html @@ -33,8 +33,8 @@ with this program; if not, write to the Free Software Foundation, Inc., - - + + diff --git a/logs/templates/logs/aff_summary.html b/logs/templates/logs/aff_summary.html index a00c4e27..4fb5c8b1 100644 --- a/logs/templates/logs/aff_summary.html +++ b/logs/templates/logs/aff_summary.html @@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col='user' text='Utilisateur' %}{% include "buttons/sort.html" with prefix='cotis' col='user' text='Utilisateur' %} Designation Prix total{% include "buttons/sort.html" with col='paiement' text='Moyen de paiement' %}{% include "buttons/sort.html" with col='date' text='Date' %}{% include "buttons/sort.html" with prefix='cotis' col='paiement' text='Moyen de paiement' %}{% include "buttons/sort.html" with prefix='cotis' col='date' text='Date' %}
Profil{% include "buttons/sort.html" with col='name' text='Nom' %}{% include "buttons/sort.html" with col='surname' text='Prénom' %}{% include "buttons/sort.html" with prefix='control' col='name' text='Nom' %}{% include "buttons/sort.html" with prefix='control' col='surname' text='Prénom' %} Designation Prix total{% include "buttons/sort.html" with col='paiement' text='Moyen de paiement' %}{% include "buttons/sort.html" with col='date' text='Date' %}{% include "buttons/sort.html" with col='valid' text='Valide' %}{% include "buttons/sort.html" with col='control' text='Contrôlée' %}{% include "buttons/sort.html" with prefix='control' col='paiement' text='Moyen de paiement' %}{% include "buttons/sort.html" with prefix='control' col='date' text='Date' %}{% include "buttons/sort.html" with prefix='control' col='valid' text='Valide' %}{% include "buttons/sort.html" with prefix='control' col='control' text='Contrôlée' %}
Objet modifié Type de l'objet{% include "buttons/sort.html" with col='author' text='Modification par' %}{% include "buttons/sort.html" with col='date' text='Date de modification' %}{% include "buttons/sort.html" with prefix='logs' col='author' text='Modification par' %}{% include "buttons/sort.html" with prefix='logs' col='date' text='Date de modification' %} Commentaire
- + diff --git a/machines/templates/machines/aff_machines.html b/machines/templates/machines/aff_machines.html index 93720997..b59bdc23 100644 --- a/machines/templates/machines/aff_machines.html +++ b/machines/templates/machines/aff_machines.html @@ -35,7 +35,7 @@ with this program; if not, write to the Free Software Foundation, Inc., - + diff --git a/re2o/utils.py b/re2o/utils.py index 5c95c47a..7ec29e87 100644 --- a/re2o/utils.py +++ b/re2o/utils.py @@ -153,76 +153,76 @@ class SortTable: # A 'default' might be provided to specify what to do if the requested col # doesn't match any keys. USERS_INDEX = { - 'name': ['name'], - 'surname': ['surname'], - 'pseudo': ['pseudo'], - 'room': ['room'], + 'user_name': ['name'], + 'user_surname': ['surname'], + 'user_pseudo': ['pseudo'], + 'user_room': ['room'], 'default': ['state', 'pseudo'] } USERS_INDEX_BAN = { - 'user': ['user__pseudo'], - 'start': ['date_start'], - 'end': ['date_end'], + 'ban_user': ['user__pseudo'], + 'ban_start': ['date_start'], + 'ban_end': ['date_end'], 'default': ['-date_end'] } USERS_INDEX_WHITE = { - 'user': ['user__pseudo'], - 'start': ['date_start'], - 'end': ['date_end'], + 'white_user': ['user__pseudo'], + 'white_start': ['date_start'], + 'white_end': ['date_end'], 'default': ['-date_end'] } MACHINES_INDEX = { - 'name': ['name'], + 'machine_name': ['name'], 'default': ['pk'] } COTISATIONS_INDEX = { - 'user': ['user__pseudo'], - 'paiement': ['paiement__moyen'], - 'date': ['date'], + 'cotis_user': ['user__pseudo'], + 'cotis_paiement': ['paiement__moyen'], + 'cotis_date': ['date'], 'default': ['-date'] } COTISATIONS_CONTROL = { - 'name': ['user__name'], - 'surname': ['user__surname'], - 'paiement': ['paiement'], - 'date': ['date'], - 'valid': ['valid'], - 'control': ['control'], + 'control_name': ['user__name'], + 'control_surname': ['user__surname'], + 'control_paiement': ['paiement'], + 'control_date': ['date'], + 'control_valid': ['valid'], + 'control_control': ['control'], 'default': ['-date'] } TOPOLOGIE_INDEX = { - 'dns': ['switch_interface__domain__name'], - 'ip': ['switch_interface__ipv4__ipv4'], - 'loc': ['location'], - 'ports': ['number'], - 'stack': ['stack__name'], + 'switch_dns': ['switch_interface__domain__name'], + 'switch_ip': ['switch_interface__ipv4__ipv4'], + 'switch_loc': ['location'], + 'switch_ports': ['number'], + 'switch_stack': ['stack__name'], 'default': ['location', 'stack', 'stack_member_id'] } TOPOLOGIE_INDEX_PORT = { - 'port': ['port'], - 'room': ['room__name'], - 'interface': ['machine_interface__domain__name'], - 'related': ['related__switch__name'], - 'radius': ['radius'], - 'vlan': ['vlan_force__name'], + 'port_port': ['port'], + 'port_room': ['room__name'], + 'port_interface': ['machine_interface__domain__name'], + 'port_related': ['related__switch__name'], + 'port_radius': ['radius'], + 'port_vlan': ['vlan_force__name'], 'default': ['port'] } TOPOLOGIE_INDEX_ROOM = { - 'name': ['name'], + 'room_name': ['name'], 'default': ['name'] } TOPOLOGIE_INDEX_STACK = { - 'name': ['name'], - 'id': ['stack_id'], + 'stack_name': ['name'], + 'stack_id': ['stack_id'], 'default': ['stack_id'], } LOGS_INDEX = { - 'date': ['revision__date_created'], + 'sum_date': ['revision__date_created'], 'default': ['-revision__date_created'], } LOGS_STATS_LOGS = { - 'author': ['user__name'], - 'date': ['date_created'], + 'logs_author': ['user__name'], + 'logs_date': ['date_created'], 'default': ['-date_created'] } diff --git a/templates/buttons/sort.html b/templates/buttons/sort.html index 7fe59784..e90fbd15 100644 --- a/templates/buttons/sort.html +++ b/templates/buttons/sort.html @@ -28,12 +28,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{{ text }} 
+ {% if prefix %} + {% with prefix|add:'_'|add:col as colname %} + + + + + + + {% endwith %} + {% else %} + {% endif %}
{% endspaceless %} diff --git a/topologie/templates/topologie/aff_chambres.html b/topologie/templates/topologie/aff_chambres.html index 8ac3e5d8..252ff808 100644 --- a/topologie/templates/topologie/aff_chambres.html +++ b/topologie/templates/topologie/aff_chambres.html @@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col='date' text='Date' %}{% include "buttons/sort.html" with prefix='sum' col='date' text='Date' %} Modification
{% include "buttons/sort.html" with col='name' text='Nom DNS' %}{% include "buttons/sort.html" with prefix='machine' col='name' text='Nom DNS' %} Type MAC IP
- + diff --git a/topologie/templates/topologie/aff_port.html b/topologie/templates/topologie/aff_port.html index 16b4f258..6d1ca08e 100644 --- a/topologie/templates/topologie/aff_port.html +++ b/topologie/templates/topologie/aff_port.html @@ -25,12 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col='name' text='Chambre' %}{% include "buttons/sort.html" with prefix='room' col='name' text='Chambre' %} Commentaire
- - - - - - + + + + + + diff --git a/topologie/templates/topologie/aff_stacks.html b/topologie/templates/topologie/aff_stacks.html index b3ac49ba..1a9d316e 100644 --- a/topologie/templates/topologie/aff_stacks.html +++ b/topologie/templates/topologie/aff_stacks.html @@ -25,8 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col='port' text='Port' %}{% include "buttons/sort.html" with col='room' text='Room' %}{% include "buttons/sort.html" with col='interface' text='Interface machine' %}{% include "buttons/sort.html" with col='related' text='Related' %}{% include "buttons/sort.html" with col='radius' text='Radius' %}{% include "buttons/sort.html" with col='vlan' text='Vlan forcé' %}{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %}{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %}{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %}{% include "buttons/sort.html" with prefix='port' col='radius' text='Radius' %}{% include "buttons/sort.html" with prefix='port' col='vlan' text='Vlan forcé' %} Détails
- - + + diff --git a/topologie/templates/topologie/aff_switch.html b/topologie/templates/topologie/aff_switch.html index 894e89a4..f503798e 100644 --- a/topologie/templates/topologie/aff_switch.html +++ b/topologie/templates/topologie/aff_switch.html @@ -25,11 +25,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col='name' text='Stack' %}{% include "buttons/sort.html" with col='id' text='ID' %}{% include "buttons/sort.html" with prefix='stack' col='name' text='Stack' %}{% include "buttons/sort.html" with prefix='stack' col='id' text='ID' %} Détails Membres
- - - - - + + + + + diff --git a/users/templates/users/aff_bans.html b/users/templates/users/aff_bans.html index 3b4b66c1..78834123 100644 --- a/users/templates/users/aff_bans.html +++ b/users/templates/users/aff_bans.html @@ -29,10 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col='dns' text='Dns' %}{% include "buttons/sort.html" with col='ip' text='Ipv4' %}{% include "buttons/sort.html" with col='loc' text='Localisation' %}{% include "buttons/sort.html" with col='ports' text='Ports' %}{% include "buttons/sort.html" with col='stack' text='Stack' %}{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}{% include "buttons/sort.html" with prefix='switch' col='ip' text='Ipv4' %}{% include "buttons/sort.html" with prefix='switch' col='loc' text='Localisation' %}{% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %}{% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %} Id interne stack Détails
- + - - + + diff --git a/users/templates/users/aff_users.html b/users/templates/users/aff_users.html index ad39ea38..c03cfa74 100644 --- a/users/templates/users/aff_users.html +++ b/users/templates/users/aff_users.html @@ -29,10 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col="user" text="Utilisateur" %}{% include "buttons/sort.html" with prefix='ban' col="user" text="Utilisateur" %} Raison{% include "buttons/sort.html" with col="start" text="Date de début" %}{% include "buttons/sort.html" with col="end" text="Date de fin" %}{% include "buttons/sort.html" with prefix='ban' col="start" text="Date de début" %}{% include "buttons/sort.html" with prefix='ban' col="end" text="Date de fin" %}
- - - - + + + + diff --git a/users/templates/users/aff_whitelists.html b/users/templates/users/aff_whitelists.html index 28b8537f..07d434c0 100644 --- a/users/templates/users/aff_whitelists.html +++ b/users/templates/users/aff_whitelists.html @@ -29,10 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with col="name" text="Prénom" %}{% include "buttons/sort.html" with col="surname" text="Nom" %}{% include "buttons/sort.html" with col="pseudo" text="Pseudo" %}{% include "buttons/sort.html" with col="room" text="Chambre" %}{% include "buttons/sort.html" with prefix='user' col="name" text="Prénom" %}{% include "buttons/sort.html" with prefix='user' col="surname" text="Nom" %}{% include "buttons/sort.html" with prefix='user' col="pseudo" text="Pseudo" %}{% include "buttons/sort.html" with prefix='user' col="room" text="Chambre" %} Fin de cotisation le Connexion Profil
- + - - + +
{% include "buttons/sort.html" with col="user" text="Utilisateur" %}{% include "buttons/sort.html" with prefix='white' col="user" text="Utilisateur" %} Raison{% include "buttons/sort.html" with col="start" text="Date de début" %}{% include "buttons/sort.html" with col="end" text="Date de fin" %}{% include "buttons/sort.html" with prefix='white' col="start" text="Date de début" %}{% include "buttons/sort.html" with prefix='white' col="end" text="Date de fin" %}