mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Gestion historique sur les ports et model de ports
This commit is contained in:
parent
bb5c9603de
commit
30a576c010
2 changed files with 4 additions and 7 deletions
|
@ -64,7 +64,7 @@ class PortForm(FormRevMixin, ModelForm):
|
||||||
super(PortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(PortForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class EditPortForm(ModelForm):
|
class EditPortForm(FormRevMixin, ModelForm):
|
||||||
"""Form pour l'édition d'un port de switche : changement des reglages
|
"""Form pour l'édition d'un port de switche : changement des reglages
|
||||||
radius ou vlan, ou attribution d'une chambre, autre port ou machine
|
radius ou vlan, ou attribution d'une chambre, autre port ou machine
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class EditPortForm(ModelForm):
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
class AddPortForm(ModelForm):
|
class AddPortForm(FormRevMixin, ModelForm):
|
||||||
"""Permet d'ajouter un port de switch. Voir EditPortForm pour plus
|
"""Permet d'ajouter un port de switch. Voir EditPortForm pour plus
|
||||||
d'informations"""
|
d'informations"""
|
||||||
class Meta(PortForm.Meta):
|
class Meta(PortForm.Meta):
|
||||||
|
@ -108,7 +108,7 @@ class AddPortForm(ModelForm):
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
class StackForm(ModelForm):
|
class StackForm(FormRevMixin, ModelForm):
|
||||||
"""Permet d'edition d'une stack : stack_id, et switches membres
|
"""Permet d'edition d'une stack : stack_id, et switches membres
|
||||||
de la stack"""
|
de la stack"""
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -160,7 +160,7 @@ class EditRoomForm(FormRevMixin, ModelForm):
|
||||||
super(EditRoomForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(EditRoomForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class CreatePortsForm(FormRevMixin, forms.Form):
|
class CreatePortsForm(forms.Form):
|
||||||
"""Permet de créer une liste de ports pour un switch."""
|
"""Permet de créer une liste de ports pour un switch."""
|
||||||
begin = forms.IntegerField(label="Début :", min_value=0)
|
begin = forms.IntegerField(label="Début :", min_value=0)
|
||||||
end = forms.IntegerField(label="Fin :", min_value=0)
|
end = forms.IntegerField(label="Fin :", min_value=0)
|
||||||
|
|
|
@ -321,7 +321,6 @@ def new_stack(request):
|
||||||
@can_edit(Stack)
|
@can_edit(Stack)
|
||||||
def edit_stack(request, stack, stackid):
|
def edit_stack(request, stack, stackid):
|
||||||
"""Edition d'un stack (nombre de switches, nom...)"""
|
"""Edition d'un stack (nombre de switches, nom...)"""
|
||||||
|
|
||||||
stack = StackForm(request.POST or None, instance=stack)
|
stack = StackForm(request.POST or None, instance=stack)
|
||||||
if stack.is_valid():
|
if stack.is_valid():
|
||||||
stack.save()
|
stack.save()
|
||||||
|
@ -433,7 +432,6 @@ def create_ports(request, switchid):
|
||||||
messages.success(request, "Ports créés.")
|
messages.success(request, "Ports créés.")
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
messages.error(request, ''.join(e))
|
messages.error(request, ''.join(e))
|
||||||
|
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'topologie:index-port',
|
'topologie:index-port',
|
||||||
kwargs={'switchid':switchid}
|
kwargs={'switchid':switchid}
|
||||||
|
@ -586,7 +584,6 @@ def new_room(request):
|
||||||
@can_edit(Room)
|
@can_edit(Room)
|
||||||
def edit_room(request, room, roomid):
|
def edit_room(request, room, roomid):
|
||||||
""" Edition numero et details de la chambre"""
|
""" Edition numero et details de la chambre"""
|
||||||
|
|
||||||
room = EditRoomForm(request.POST or None, instance=room)
|
room = EditRoomForm(request.POST or None, instance=room)
|
||||||
if room.is_valid():
|
if room.is_valid():
|
||||||
room.save()
|
room.save()
|
||||||
|
|
Loading…
Reference in a new issue