From 91650942b1d9e62aae51ed5aa60e417f13e08438 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Thu, 24 Nov 2016 03:11:04 +0100 Subject: [PATCH] Class les ports dans l'ordre --- topologie/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/topologie/forms.py b/topologie/forms.py index f93d80b4..954ce47a 100644 --- a/topologie/forms.py +++ b/topologie/forms.py @@ -10,6 +10,10 @@ class EditPortForm(ModelForm): class Meta(PortForm.Meta): fields = ['room', 'machine_interface', 'related', 'details'] + def __init__(self, *args, **kwargs): + super(EditPortForm, self).__init__(*args, **kwargs) + self.fields['related'].queryset = Port.objects.all().order_by('switch', 'port') + class AddPortForm(ModelForm): class Meta(PortForm.Meta): fields = ['port', 'room', 'machine_interface', 'related', 'details']