From dbc15118ecd588e72cd27830cf2381778ec5fb64 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 27 Oct 2018 23:31:12 +0200 Subject: [PATCH] Fix display switchs order --- preferences/forms.py | 2 +- preferences/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/preferences/forms.py b/preferences/forms.py index 5933107c..2f90927f 100644 --- a/preferences/forms.py +++ b/preferences/forms.py @@ -120,7 +120,7 @@ class EditOptionalTopologieForm(ModelForm): self.fields['vlan_decision_nok'].label = _("VLAN for machines rejected" " by RADIUS") - self.initial['automatic_provision_switchs'] = Switch.objects.filter(automatic_provision=True) + self.initial['automatic_provision_switchs'] = Switch.objects.filter(automatic_provision=True).order_by('interface__domain__name') def save(self, commit=True): instance = super().save(commit) diff --git a/preferences/models.py b/preferences/models.py index dc391317..b21f42fe 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -260,7 +260,7 @@ class OptionalTopologie(AclMixin, PreferencesModel): def provisioned_switchs(self): """Liste des switches provisionnés""" from topologie.models import Switch - return Switch.objects.filter(automatic_provision=True) + return Switch.objects.filter(automatic_provision=True).order_by('interface__domain__name') @cached_property def switchs_management_interface(self):