8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 11:53:12 +00:00

Fix assignation de l'ip

This commit is contained in:
Gabriel Detraz 2018-03-25 04:51:48 +02:00 committed by chirac
parent 3a2e007372
commit 3293dff1a4
2 changed files with 4 additions and 16 deletions

View file

@ -132,12 +132,6 @@ class EditSwitchForm(EditInterfaceForm):
model = Switch
fields = ['machine', 'type', 'ipv4', 'mac_address', 'details', 'location', 'number', 'stack', 'stack_member_id']
# def __init__(self, *args, **kwargs):
# prefix = kwargs.pop('prefix', self.Meta.model.__name__)
# super(EditInterfaceForm, self).__init__(*args, prefix=prefix, **kwargs)
# self.fields['location'].label = 'Localisation'
# self.fields['number'].label = 'Nombre de ports'
class NewSwitchForm(EditInterfaceForm):
"""Permet de créer un switch : emplacement, paramètres machine,
@ -145,11 +139,6 @@ class NewSwitchForm(EditInterfaceForm):
class Meta(EditSwitchForm.Meta):
fields = ['type', 'ipv4', 'mac_address', 'details', 'location', 'number', 'stack', 'stack_member_id']
#def __init__(self, *args, **kwargs):
# prefix = kwargs.pop('prefix', self.Meta.model.__name__)
# super(NewSwitchForm, self).__init__(*args, prefix=prefix, **kwargs)
# self.fields['location'].label = 'Localisation'
# self.fields['number'].label = 'Nombre de ports'
class EditRoomForm(ModelForm):
"""Permet d'éediter le nom et commentaire d'une prise murale"""

View file

@ -190,7 +190,7 @@ class Switch(Interface):
class Meta:
unique_together = ('stack', 'stack_member_id')
permissions = (
("view_newswitch", "Peut voir un objet switch"),
("view_switch", "Peut voir un objet switch"),
)
def get_instance(switch_id, *args, **kwargs):
@ -220,11 +220,10 @@ class Switch(Interface):
return False, u"Vous n'avez pas le droit de voir les switch"
return True, None
# def __str__(self):
# return self.location + ' ' + str(self.switch_interface)
def clean(self):
""" Verifie que l'id stack est dans le bon range"""
""" Verifie que l'id stack est dans le bon range
Appelle également le clean de la classe parente"""
super(Switch, self).clean()
if self.stack is not None:
if self.stack_member_id is not None:
if (self.stack_member_id > self.stack.member_id_max) or\