From 25a6308f81e90523d9cd922705480820134c486a Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Thu, 7 Jul 2016 21:53:51 +0200 Subject: [PATCH] =?UTF-8?q?Attribution=20d'ip=20=C3=A0=20la=20creation=20d?= =?UTF-8?q?e=20la=20machine=20possible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- machines/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/machines/views.py b/machines/views.py index 5d7ec19c..ffa3a320 100644 --- a/machines/views.py +++ b/machines/views.py @@ -54,16 +54,16 @@ def new_machine(request, userid): messages.error(request, u"Utilisateur inexistant" ) return redirect("/machines/") machine = NewMachineForm(request.POST or None) - interface = NewInterfaceForm(request.POST or None) + interface = AddInterfaceForm(request.POST or None) if machine.is_valid() and interface.is_valid(): new_machine = machine.save(commit=False) new_machine.user = user new_machine.save() new_interface = interface.save(commit=False) new_interface.machine = new_machine - if free_ip(): + if free_ip() and not new_interface.ipv4: new_interface = assign_ipv4(new_interface) - else: + elif not new_interface.ipv4: messages.error(request, u"Il n'y a plus d'ip disponibles") new_interface.save() messages.success(request, "La machine a été crée")