From 4adc6e8fc8d499ed6704a94863e636ce6788e164 Mon Sep 17 00:00:00 2001 From: chirac Date: Wed, 18 Oct 2017 03:09:47 +0200 Subject: [PATCH] Opti l'ajout de port --- topologie/forms.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/topologie/forms.py b/topologie/forms.py index 5f5993a4..c8e39d6a 100644 --- a/topologie/forms.py +++ b/topologie/forms.py @@ -82,6 +82,11 @@ class AddPortForm(ModelForm): def __init__(self, *args, **kwargs): prefix = kwargs.pop('prefix', self.Meta.model.__name__) super(AddPortForm, self).__init__(*args, prefix=prefix, **kwargs) + self.fields['machine_interface'].queryset = Interface.objects.all()\ + .select_related('domain__extension') + self.fields['related'].queryset = Port.objects.all()\ + .select_related('switch__switch_interface__domain__extension')\ + .order_by('switch', 'port') class StackForm(ModelForm):