mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 07:02:26 +00:00
Fix DomainForm usage.
This commit is contained in:
parent
ef93bd7975
commit
42f65bea6a
2 changed files with 12 additions and 7 deletions
|
@ -292,7 +292,8 @@ def edit_interface(request, interface_instance, **_kwargs):
|
||||||
)
|
)
|
||||||
domain_form = DomainForm(
|
domain_form = DomainForm(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
instance=interface_instance.domain
|
instance=interface_instance.domain,
|
||||||
|
user=request.user
|
||||||
)
|
)
|
||||||
if (machine_form.is_valid() and
|
if (machine_form.is_valid() and
|
||||||
interface_form.is_valid() and
|
interface_form.is_valid() and
|
||||||
|
@ -349,7 +350,7 @@ def new_interface(request, machine, **_kwargs):
|
||||||
""" Ajoute une interface et son domain associé à une machine existante"""
|
""" Ajoute une interface et son domain associé à une machine existante"""
|
||||||
|
|
||||||
interface_form = AddInterfaceForm(request.POST or None, user=request.user)
|
interface_form = AddInterfaceForm(request.POST or None, user=request.user)
|
||||||
domain_form = DomainForm(request.POST or None)
|
domain_form = DomainForm(request.POST or None, user=request.user)
|
||||||
if interface_form.is_valid():
|
if interface_form.is_valid():
|
||||||
new_interface_obj = interface_form.save(commit=False)
|
new_interface_obj = interface_form.save(commit=False)
|
||||||
domain_form.instance.interface_parent = new_interface_obj
|
domain_form.instance.interface_parent = new_interface_obj
|
||||||
|
|
|
@ -69,7 +69,7 @@ from machines.forms import (
|
||||||
from machines.views import generate_ipv4_mbf_param
|
from machines.views import generate_ipv4_mbf_param
|
||||||
from machines.models import (
|
from machines.models import (
|
||||||
Interface,
|
Interface,
|
||||||
Service_link,
|
Service_link,
|
||||||
Vlan
|
Vlan
|
||||||
)
|
)
|
||||||
from preferences.models import AssoOption, GeneralOption
|
from preferences.models import AssoOption, GeneralOption
|
||||||
|
@ -524,6 +524,7 @@ def new_switch(request):
|
||||||
)
|
)
|
||||||
domain = DomainForm(
|
domain = DomainForm(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
|
user=request.user
|
||||||
)
|
)
|
||||||
if switch.is_valid() and interface.is_valid():
|
if switch.is_valid() and interface.is_valid():
|
||||||
user = AssoOption.get_cached_value('utilisateur_asso')
|
user = AssoOption.get_cached_value('utilisateur_asso')
|
||||||
|
@ -570,7 +571,7 @@ def create_ports(request, switchid):
|
||||||
except Switch.DoesNotExist:
|
except Switch.DoesNotExist:
|
||||||
messages.error(request, _("Nonexistent switch."))
|
messages.error(request, _("Nonexistent switch."))
|
||||||
return redirect(reverse('topologie:index'))
|
return redirect(reverse('topologie:index'))
|
||||||
|
|
||||||
first_port = getattr(switch.ports.order_by('port').first(), 'port', 1)
|
first_port = getattr(switch.ports.order_by('port').first(), 'port', 1)
|
||||||
last_port = switch.number + first_port - 1
|
last_port = switch.number + first_port - 1
|
||||||
port_form = CreatePortsForm(
|
port_form = CreatePortsForm(
|
||||||
|
@ -614,7 +615,8 @@ def edit_switch(request, switch, switchid):
|
||||||
)
|
)
|
||||||
domain_form = DomainForm(
|
domain_form = DomainForm(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
instance=switch.interface_set.first().domain
|
instance=switch.interface_set.first().domain,
|
||||||
|
domain=request.user
|
||||||
)
|
)
|
||||||
if switch_form.is_valid() and interface_form.is_valid():
|
if switch_form.is_valid() and interface_form.is_valid():
|
||||||
new_switch_obj = switch_form.save(commit=False)
|
new_switch_obj = switch_form.save(commit=False)
|
||||||
|
@ -659,6 +661,7 @@ def new_ap(request):
|
||||||
)
|
)
|
||||||
domain = DomainForm(
|
domain = DomainForm(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
|
user=request.user
|
||||||
)
|
)
|
||||||
if ap.is_valid() and interface.is_valid():
|
if ap.is_valid() and interface.is_valid():
|
||||||
user = AssoOption.get_cached_value('utilisateur_asso')
|
user = AssoOption.get_cached_value('utilisateur_asso')
|
||||||
|
@ -713,7 +716,8 @@ def edit_ap(request, ap, **_kwargs):
|
||||||
)
|
)
|
||||||
domain_form = DomainForm(
|
domain_form = DomainForm(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
instance=ap.interface_set.first().domain
|
instance=ap.interface_set.first().domain,
|
||||||
|
user=request.user
|
||||||
)
|
)
|
||||||
if ap_form.is_valid() and interface_form.is_valid():
|
if ap_form.is_valid() and interface_form.is_valid():
|
||||||
user = AssoOption.get_cached_value('utilisateur_asso')
|
user = AssoOption.get_cached_value('utilisateur_asso')
|
||||||
|
@ -1279,7 +1283,7 @@ def make_machine_graph():
|
||||||
.select_related('ipv4__ip_type__extension')
|
.select_related('ipv4__ip_type__extension')
|
||||||
.select_related('domain__extension')
|
.select_related('domain__extension')
|
||||||
)
|
)
|
||||||
)))
|
)))
|
||||||
detected = []
|
detected = []
|
||||||
for building in Building.objects.all(): # Visit all buildings
|
for building in Building.objects.all(): # Visit all buildings
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue