Commit 3293dff1 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by chirac

Fix assignation de l'ip

parent 3a2e0073
......@@ -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"""
......
......@@ -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\
......
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