8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 17:33:45 +00:00

Optimisation

This commit is contained in:
Gabriel Detraz 2017-02-02 02:21:39 +01:00 committed by root
parent efe4421e5d
commit 7afd446438

View file

@ -725,13 +725,13 @@ class JSONResponse(HttpResponse):
@csrf_exempt @csrf_exempt
@login_required @login_required
@permission_required('serveur') @permission_required('serveur')
def interface_list(request): def mac_ip_list(request):
interfaces = Interface.objects.all() interfaces = Interface.objects.select_related('ipv4').select_related('domain').all()
interface = [] filter(
for i in interfaces : lambda interface: interface.ipv4 and interface.is_active(),
if i.ipv4 and i.is_active(): interfaces
interface.append(i) )
seria = InterfaceSerializer(interface, many=True) seria = InterfaceSerializer(interfaces, many=True)
return seria.data return seria.data
@csrf_exempt @csrf_exempt
@ -778,14 +778,14 @@ def zones(request):
@login_required @login_required
@permission_required('serveur') @permission_required('serveur')
def mac_ip(request): def mac_ip(request):
seria = interface_list(request) seria = mac_ip_list(request)
return JSONResponse(seria) return JSONResponse(seria)
@csrf_exempt @csrf_exempt
@login_required @login_required
@permission_required('serveur') @permission_required('serveur')
def mac_ip_dns(request): def mac_ip_dns(request):
seria = interface_list(request) seria = mac_ip_list(request)
return JSONResponse(seria) return JSONResponse(seria)
@csrf_exempt @csrf_exempt