mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-25 08:23:46 +00:00
Bricoles, lacp pour les serveurs, retire l'unicité
This commit is contained in:
parent
91f533ef83
commit
a77ecd25f0
4 changed files with 54 additions and 5 deletions
20
topologie/migrations/0020_auto_20161119_0033.py
Normal file
20
topologie/migrations/0020_auto_20161119_0033.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- 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
|
||||
|
|
29
users/migrations/0039_auto_20161119_0033.py
Normal file
29
users/migrations/0039_auto_20161119_0033.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
# -*- 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),
|
||||
),
|
||||
]
|
Loading…
Reference in a new issue