8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 19:33:11 +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 f23be79c0d
commit 0399633cef
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.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()

View file

@ -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)