Browse Source

Remplace location par bayswitch

Fix_strange_foreign_key_state
Gabriel Detraz 8 years ago
committed by chirac
parent
commit
a621d378ec
  1. 4
      re2o/utils.py
  2. 2
      topologie/forms.py
  3. 19
      topologie/migrations/0058_remove_switch_location.py
  4. 1
      topologie/models.py
  5. 6
      topologie/templates/topologie/aff_switch.html

4
re2o/utils.py

@ -220,10 +220,10 @@ class SortTable:
TOPOLOGIE_INDEX = { TOPOLOGIE_INDEX = {
'switch_dns': ['interface__domain__name'], 'switch_dns': ['interface__domain__name'],
'switch_ip': ['interface__ipv4__ipv4'], 'switch_ip': ['interface__ipv4__ipv4'],
'switch_loc': ['location'], 'switch_loc': ['switchbay__name'],
'switch_ports': ['number'], 'switch_ports': ['number'],
'switch_stack': ['stack__name'], 'switch_stack': ['stack__name'],
'default': ['location', 'stack', 'stack_member_id'] 'default': ['switchbay', 'stack', 'stack_member_id']
} }
TOPOLOGIE_INDEX_PORT = { TOPOLOGIE_INDEX_PORT = {
'port_port': ['port'], 'port_port': ['port'],

2
topologie/forms.py

@ -148,7 +148,7 @@ class NewSwitchForm(NewMachineForm):
"""Permet de créer un switch : emplacement, paramètres machine, """Permet de créer un switch : emplacement, paramètres machine,
membre d'un stack (option), nombre de ports (number)""" membre d'un stack (option), nombre de ports (number)"""
class Meta(EditSwitchForm.Meta): class Meta(EditSwitchForm.Meta):
fields = ['name', 'location', 'number', 'stack', 'stack_member_id'] fields = ['name', 'switchbay', 'number', 'stack', 'stack_member_id']
class EditRoomForm(FormRevMixin, ModelForm): class EditRoomForm(FormRevMixin, ModelForm):

19
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',
),
]

1
topologie/models.py

@ -121,7 +121,6 @@ class Switch(AclMixin, Machine):
PRETTY_NAME = "Switch / Commutateur" PRETTY_NAME = "Switch / Commutateur"
location = models.CharField(max_length=255)
number = models.PositiveIntegerField() number = models.PositiveIntegerField()
stack = models.ForeignKey( stack = models.ForeignKey(
'topologie.Stack', 'topologie.Stack',

6
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 %} {% include "pagination.html" with list=switch_list %}
{% endif %} {% endif %}
<div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}</th> <th>{% include "buttons/sort.html" with prefix='switch' col='dns' text='Dns' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ip' text='Ipv4' %}</th> <th>{% include "buttons/sort.html" with prefix='switch' col='ip' text='Ipv4' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='loc' text='Localisation' %}</th> <th>{% include "buttons/sort.html" with prefix='switch' col='loc' text='Emplacement' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %}</th> <th>{% include "buttons/sort.html" with prefix='switch' col='ports' text='Ports' %}</th>
<th>{% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %}</th> <th>{% include "buttons/sort.html" with prefix='switch' col='stack' text='Stack' %}</th>
<th>Id stack</th> <th>Id stack</th>
@ -50,7 +51,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</a> </a>
</td> </td>
<td>{{switch.interface_set.first.ipv4}}</td> <td>{{switch.interface_set.first.ipv4}}</td>
<td>{{switch.location}}</td> <td>{{switch.switchbay}}</td>
<td>{{switch.number}}</td> <td>{{switch.number}}</td>
<td>{{switch.stack.name}}</td> <td>{{switch.stack.name}}</td>
<td>{{switch.stack_member_id}}</td> <td>{{switch.stack_member_id}}</td>
@ -71,6 +72,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% if switch_list.paginator %} {% if switch_list.paginator %}
{% include "pagination.html" with list=switch_list %} {% include "pagination.html" with list=switch_list %}

Loading…
Cancel
Save