8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-30 00:22:25 +00:00

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

Conflicts:
	machines/views.py
This commit is contained in:
Gabriel Detraz 2017-05-27 04:39:53 +02:00 committed by root
parent ccd918b6bb
commit f7e347f1ef
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__in=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)