forms.py 652 Bytes
Newer Older
Dalahro's avatar
Dalahro committed
1
from .models import Port, Switch
Dalahro's avatar
Dalahro committed
2 3 4 5 6 7 8 9 10 11
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']
Dalahro's avatar
Dalahro committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25

class AddPortForm(ModelForm):
    class Meta(PortForm.Meta):
        fields = ['port', 'room', 'machine_interface', 'related', 'details']

class SwitchForm(ModelForm):
    class Meta:
        model = Switch
        fields = '__all__'

class EditSwitchForm(ModelForm):
    class Meta(SwitchForm.Meta):
        fields = ['building', 'number', 'details']