mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 22:52:26 +00:00
Optimisation sur le menu d'edition d'une machine (accèlère)
This commit is contained in:
parent
f23be79c0d
commit
0399633cef
2 changed files with 4 additions and 1 deletions
|
@ -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()
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue