From a621d378ecb881d4637b4df0120d27bd04420fd7 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 8 Apr 2018 04:12:58 +0200 Subject: [PATCH] Remplace location par bayswitch --- re2o/utils.py | 4 ++-- topologie/forms.py | 2 +- .../migrations/0058_remove_switch_location.py | 19 +++++++++++++++++++ topologie/models.py | 1 - topologie/templates/topologie/aff_switch.html | 6 ++++-- 5 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 topologie/migrations/0058_remove_switch_location.py diff --git a/re2o/utils.py b/re2o/utils.py index fc268e22..3bbfffd4 100644 --- a/re2o/utils.py +++ b/re2o/utils.py @@ -220,10 +220,10 @@ class SortTable: TOPOLOGIE_INDEX = { 'switch_dns': ['interface__domain__name'], 'switch_ip': ['interface__ipv4__ipv4'], - 'switch_loc': ['location'], + 'switch_loc': ['switchbay__name'], 'switch_ports': ['number'], 'switch_stack': ['stack__name'], - 'default': ['location', 'stack', 'stack_member_id'] + 'default': ['switchbay', 'stack', 'stack_member_id'] } TOPOLOGIE_INDEX_PORT = { 'port_port': ['port'], diff --git a/topologie/forms.py b/topologie/forms.py index 6d96a5af..bb0c2888 100644 --- a/topologie/forms.py +++ b/topologie/forms.py @@ -148,7 +148,7 @@ class NewSwitchForm(NewMachineForm): """Permet de créer un switch : emplacement, paramètres machine, membre d'un stack (option), nombre de ports (number)""" class Meta(EditSwitchForm.Meta): - fields = ['name', 'location', 'number', 'stack', 'stack_member_id'] + fields = ['name', 'switchbay', 'number', 'stack', 'stack_member_id'] class EditRoomForm(FormRevMixin, ModelForm): diff --git a/topologie/migrations/0058_remove_switch_location.py b/topologie/migrations/0058_remove_switch_location.py new file mode 100644 index 00000000..0d75fc67 --- /dev/null +++ b/topologie/migrations/0058_remove_switch_location.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-04-08 02:06 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('topologie', '0057_auto_20180408_0316'), + ] + + operations = [ + migrations.RemoveField( + model_name='switch', + name='location', + ), + ] diff --git a/topologie/models.py b/topologie/models.py index b30c5a55..2a42957b 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -121,7 +121,6 @@ class Switch(AclMixin, Machine): PRETTY_NAME = "Switch / Commutateur" - location = models.CharField(max_length=255) number = models.PositiveIntegerField() stack = models.ForeignKey( 'topologie.Stack', diff --git a/topologie/templates/topologie/aff_switch.html b/topologie/templates/topologie/aff_switch.html index bcbe5204..a8547243 100644 --- a/topologie/templates/topologie/aff_switch.html +++ b/topologie/templates/topologie/aff_switch.html @@ -28,12 +28,13 @@ with this program; if not, write to the Free Software Foundation, Inc., {% include "pagination.html" with list=switch_list %} {% endif %} +
- + @@ -50,7 +51,7 @@ with this program; if not, write to the Free Software Foundation, Inc., - + @@ -71,6 +72,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endfor %}
{% 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='loc' text='Emplacement' %} {% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %} {% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %} Id stack {{switch.interface_set.first.ipv4}}{{switch.location}}{{switch.switchbay}} {{switch.number}} {{switch.stack.name}} {{switch.stack_member_id}}
+
{% if switch_list.paginator %} {% include "pagination.html" with list=switch_list %}