8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-26 14:42:25 +00:00
re2o/topologie/forms.py

35 lines
975 B
Python
Raw Normal View History

2016-07-19 00:30:52 +00:00
from .models import Port, Switch, Room
from django.forms import ModelForm, Form
class PortForm(ModelForm):
class Meta:
model = Port
fields = '__all__'
class EditPortForm(ModelForm):
class Meta(PortForm.Meta):
fields = ['room', 'machine_interface', 'related', 'details']
2016-07-06 21:29:31 +00:00
class AddPortForm(ModelForm):
class Meta(PortForm.Meta):
fields = ['port', 'room', 'machine_interface', 'related', 'details']
2016-10-26 12:05:40 +00:00
class EditSwitchForm(ModelForm):
2016-07-06 21:29:31 +00:00
class Meta:
model = Switch
fields = '__all__'
2016-10-26 12:05:40 +00:00
def __init__(self, *args, **kwargs):
super(EditSwitchForm, self).__init__(*args, **kwargs)
self.fields['location'].label = 'Localisation'
self.fields['number'].label = 'Nombre de ports'
class NewSwitchForm(ModelForm):
class Meta(EditSwitchForm.Meta):
fields = ['location', 'number', 'details']
2016-07-06 21:29:31 +00:00
2016-07-19 00:30:52 +00:00
class EditRoomForm(ModelForm):
class Meta:
model = Room
fields = '__all__'