mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-30 08:32:26 +00:00
Fix bug nomage machine -> referencement utilisateur cible
This commit is contained in:
parent
cb999b260c
commit
740746febd
2 changed files with 2 additions and 7 deletions
|
@ -160,11 +160,6 @@ class DomainForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
fields = ["name", "ttl"]
|
fields = ["name", "ttl"]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
if "user" in kwargs:
|
|
||||||
user = kwargs["user"]
|
|
||||||
initial = kwargs.get("initial", {})
|
|
||||||
initial["name"] = user.get_next_domain_name()
|
|
||||||
kwargs["initial"] = initial
|
|
||||||
prefix = kwargs.pop("prefix", self.Meta.model.__name__)
|
prefix = kwargs.pop("prefix", self.Meta.model.__name__)
|
||||||
super(DomainForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(DomainForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ def new_machine(request, user, **_kwargs):
|
||||||
|
|
||||||
machine = NewMachineForm(request.POST or None, user=request.user)
|
machine = NewMachineForm(request.POST or None, user=request.user)
|
||||||
interface = AddInterfaceForm(request.POST or None, user=request.user)
|
interface = AddInterfaceForm(request.POST or None, user=request.user)
|
||||||
domain = DomainForm(request.POST or None, user=user)
|
domain = DomainForm(request.POST or None, user=user, initial={'name': user.get_next_domain_name()})
|
||||||
if machine.is_valid() and interface.is_valid():
|
if machine.is_valid() and interface.is_valid():
|
||||||
new_machine_obj = machine.save(commit=False)
|
new_machine_obj = machine.save(commit=False)
|
||||||
new_machine_obj.user = user
|
new_machine_obj.user = user
|
||||||
|
@ -325,7 +325,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, user=request.user)
|
domain_form = DomainForm(request.POST or None, user=request.user, initial={'name': machine.user.get_next_domain_name()})
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue