From 1baf52ac6eb7f3c434483e83b4c862fb8419d76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Kervella?= Date: Mon, 2 Oct 2017 23:53:55 +0000 Subject: [PATCH] =?UTF-8?q?R=C3=A9cup=C3=A8re=20les=20associations=20machi?= =?UTF-8?q?ne=5Ftype->ip=20pour=20le=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- machines/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/machines/views.py b/machines/views.py index 4268519b..aa702438 100644 --- a/machines/views.py +++ b/machines/views.py @@ -117,7 +117,10 @@ def new_machine(request, userid): reversion.set_comment("Création") messages.success(request, "La machine a été créée") return redirect("/users/profil/" + str(user.id)) - return form({'machineform': machine, 'interfaceform': interface, 'domainform': domain}, 'machines/machine.html', request) + type_to_ipv4 = {} + for t in interface.fields['type'].queryset : + type_to_ipv4[str(t.id)] = IpList.objects.filter(interface__isnull=True).filter(ip_type=t.ip_type) + return form({'machineform': machine, 'interfaceform': interface, 'domainform': domain, 'type_to_ipv4': type_to_ipv4}, 'machines/machine.html', request) @login_required def edit_interface(request, interfaceid):