Commit 5acaa25c authored by Gabriel Detraz's avatar Gabriel Detraz Committed by Brelivet Simon

Bricoles, lacp pour les serveurs, retire l'unicité

parent 018f6c3e
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('topologie', '0019_auto_20161026_1348'),
]
operations = [
migrations.AlterField(
model_name='port',
name='machine_interface',
field=models.ForeignKey(blank=True, to='machines.Interface', null=True, on_delete=django.db.models.deletion.SET_NULL),
),
]
......@@ -24,7 +24,7 @@ class Switch(models.Model):
details = models.CharField(max_length=255, blank=True)
def __str__(self):
return str(self.location)
return str(self.location) + ' ' + str(self.switch_interface)
class Port(models.Model):
PRETTY_NAME = "Port de switch"
......@@ -32,7 +32,7 @@ class Port(models.Model):
switch = models.ForeignKey('Switch', related_name="ports")
port = models.IntegerField()
room = models.ForeignKey('Room', on_delete=models.PROTECT, blank=True, null=True)
machine_interface = models.OneToOneField('machines.Interface', on_delete=models.SET_NULL, blank=True, null=True)
machine_interface = models.ForeignKey('machines.Interface', on_delete=models.SET_NULL, blank=True, null=True)
related = models.OneToOneField('self', null=True, blank=True, related_name='related_port')
details = models.CharField(max_length=255, blank=True)
......
......@@ -103,18 +103,18 @@ def new_port(request, switch_id):
@permission_required('infra')
def edit_port(request, port_id):
try:
port = Port.objects.get(pk=port_id)
port_object = Port.objects.get(pk=port_id)
except Port.DoesNotExist:
messages.error(request, u"Port inexistant")
return redirect("/topologie/")
port = EditPortForm(request.POST or None, instance=port)
port = EditPortForm(request.POST or None, instance=port_object)
if port.is_valid():
with transaction.atomic(), reversion.create_revision():
port.save()
reversion.set_user(request.user)
reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in port.changed_data))
messages.success(request, "Le port a bien été modifié")
return redirect("/topologie/")
return redirect("/topologie/switch/" + str(port_object.switch.id))
return form({'topoform':port}, 'topologie/topo.html', request)
@login_required
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0038_auto_20161031_0258'),
]
operations = [
migrations.AlterField(
model_name='ldapserviceuser',
name='dn',
field=models.CharField(serialize=False, max_length=200, primary_key=True),
),
migrations.AlterField(
model_name='ldapuser',
name='dn',
field=models.CharField(serialize=False, max_length=200, primary_key=True),
),
migrations.AlterField(
model_name='ldapusergroup',
name='dn',
field=models.CharField(serialize=False, max_length=200, primary_key=True),
),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment