8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-05 01:16:27 +00:00

Optimisation sur le menu d'edition d'une machine (accèlère)

This commit is contained in:
Gabriel Detraz 2017-05-27 04:39:53 +02:00 committed by root
parent 0b07028832
commit d8a73a4575
2 changed files with 4 additions and 1 deletions

View file

@ -26,6 +26,8 @@ from .models import Domain, Machine, Interface, IpList, MachineType, Extension,
from django.db.models import Q from django.db.models import Q
from django.core.validators import validate_email from django.core.validators import validate_email
from users.models import User
class EditMachineForm(ModelForm): class EditMachineForm(ModelForm):
class Meta: class Meta:
model = Machine model = Machine
@ -53,6 +55,7 @@ class EditInterfaceForm(ModelForm):
self.fields['mac_address'].label = 'Adresse mac' self.fields['mac_address'].label = 'Adresse mac'
self.fields['type'].label = 'Type de machine' self.fields['type'].label = 'Type de machine'
self.fields['type'].empty_label = "Séléctionner un 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): def clean(self):
data = super(EditInterfaceForm, self).clean() data = super(EditInterfaceForm, self).clean()

View file

@ -751,7 +751,7 @@ def mac_ip_list(request):
@login_required @login_required
@permission_required('serveur') @permission_required('serveur')
def alias(request): 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) seria = DomainSerializer(alias, many=True)
return JSONResponse(seria.data) return JSONResponse(seria.data)