From d8a73a4575a457e67321bb0a32544b9b2434aedf Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 27 May 2017 04:39:53 +0200 Subject: [PATCH] =?UTF-8?q?Optimisation=20sur=20le=20menu=20d'edition=20d'?= =?UTF-8?q?une=20machine=20(acc=C3=A8l=C3=A8re)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- machines/forms.py | 3 +++ machines/views.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/machines/forms.py b/machines/forms.py index 7b90e2b9..ab141b49 100644 --- a/machines/forms.py +++ b/machines/forms.py @@ -26,6 +26,8 @@ from .models import Domain, Machine, Interface, IpList, MachineType, Extension, from django.db.models import Q from django.core.validators import validate_email +from users.models import User + class EditMachineForm(ModelForm): class Meta: model = Machine @@ -53,6 +55,7 @@ class EditInterfaceForm(ModelForm): self.fields['mac_address'].label = 'Adresse mac' self.fields['type'].label = 'Type de machine' self.fields['type'].empty_label = "Séléctionner un type de machine" + self.fields['machine'].queryset = Machine.objects.all().select_related('user') def clean(self): data = super(EditInterfaceForm, self).clean() diff --git a/machines/views.py b/machines/views.py index 8d623044..7b1af78a 100644 --- a/machines/views.py +++ b/machines/views.py @@ -751,7 +751,7 @@ def mac_ip_list(request): @login_required @permission_required('serveur') def alias(request): - alias = Domain.objects.filter(interface_parent=None).filter(cname=Domain.objects.filter(interface_parent__in=Interface.objects.exclude(ipv4=None))) + alias = Domain.objects.filter(interface_parent=None).filter(cname=Domain.objects.filter(interface_parent__in=Interface.objects.exclude(ipv4=None))).select_related('extension') seria = DomainSerializer(alias, many=True) return JSONResponse(seria.data)