mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Can_delete_set sur machines
This commit is contained in:
parent
e73a0c7992
commit
e905fa9aef
2 changed files with 135 additions and 47 deletions
|
@ -233,11 +233,19 @@ class MachineTypeForm(ModelForm):
|
||||||
class DelMachineTypeForm(Form):
|
class DelMachineTypeForm(Form):
|
||||||
"""Suppression d'un ou plusieurs machinetype"""
|
"""Suppression d'un ou plusieurs machinetype"""
|
||||||
machinetypes = forms.ModelMultipleChoiceField(
|
machinetypes = forms.ModelMultipleChoiceField(
|
||||||
queryset=MachineType.objects.all(),
|
queryset=MachineType.objects.none(),
|
||||||
label="Types de machines actuelles",
|
label="Types de machines actuelles",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelMachineTypeForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['machinetypes'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['machinetypes'].queryset = MachineType.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class IpTypeForm(ModelForm):
|
class IpTypeForm(ModelForm):
|
||||||
"""Formulaire d'ajout d'un iptype. Pas d'edition de l'ip de start et de
|
"""Formulaire d'ajout d'un iptype. Pas d'edition de l'ip de start et de
|
||||||
|
@ -264,11 +272,19 @@ class EditIpTypeForm(IpTypeForm):
|
||||||
class DelIpTypeForm(Form):
|
class DelIpTypeForm(Form):
|
||||||
"""Suppression d'un ou plusieurs iptype"""
|
"""Suppression d'un ou plusieurs iptype"""
|
||||||
iptypes = forms.ModelMultipleChoiceField(
|
iptypes = forms.ModelMultipleChoiceField(
|
||||||
queryset=IpType.objects.all(),
|
queryset=IpType.objects.none(),
|
||||||
label="Types d'ip actuelles",
|
label="Types d'ip actuelles",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelIpTypeForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['iptypes'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['iptypes'].queryset = IpType.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class ExtensionForm(ModelForm):
|
class ExtensionForm(ModelForm):
|
||||||
"""Formulaire d'ajout et edition d'une extension"""
|
"""Formulaire d'ajout et edition d'une extension"""
|
||||||
|
@ -288,11 +304,19 @@ class ExtensionForm(ModelForm):
|
||||||
class DelExtensionForm(Form):
|
class DelExtensionForm(Form):
|
||||||
"""Suppression d'une ou plusieurs extensions"""
|
"""Suppression d'une ou plusieurs extensions"""
|
||||||
extensions = forms.ModelMultipleChoiceField(
|
extensions = forms.ModelMultipleChoiceField(
|
||||||
queryset=Extension.objects.all(),
|
queryset=Extension.objects.none(),
|
||||||
label="Extensions actuelles",
|
label="Extensions actuelles",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelExtensionForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['extensions'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['extensions'].queryset = Extension.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class SOAForm(ModelForm):
|
class SOAForm(ModelForm):
|
||||||
"""Ajout et edition d'un SOA"""
|
"""Ajout et edition d'un SOA"""
|
||||||
|
@ -308,11 +332,19 @@ class SOAForm(ModelForm):
|
||||||
class DelSOAForm(Form):
|
class DelSOAForm(Form):
|
||||||
"""Suppression d'un ou plusieurs SOA"""
|
"""Suppression d'un ou plusieurs SOA"""
|
||||||
soa = forms.ModelMultipleChoiceField(
|
soa = forms.ModelMultipleChoiceField(
|
||||||
queryset=SOA.objects.all(),
|
queryset=SOA.objects.none(),
|
||||||
label="SOA actuels",
|
label="SOA actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelSOAForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['soa'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['soa'].queryset = SOA.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class MxForm(ModelForm):
|
class MxForm(ModelForm):
|
||||||
"""Ajout et edition d'un MX"""
|
"""Ajout et edition d'un MX"""
|
||||||
|
@ -327,15 +359,22 @@ class MxForm(ModelForm):
|
||||||
interface_parent=None
|
interface_parent=None
|
||||||
).select_related('extension')
|
).select_related('extension')
|
||||||
|
|
||||||
|
|
||||||
class DelMxForm(Form):
|
class DelMxForm(Form):
|
||||||
"""Suppression d'un ou plusieurs MX"""
|
"""Suppression d'un ou plusieurs MX"""
|
||||||
mx = forms.ModelMultipleChoiceField(
|
mx = forms.ModelMultipleChoiceField(
|
||||||
queryset=Mx.objects.all(),
|
queryset=Mx.objects.none(),
|
||||||
label="MX actuels",
|
label="MX actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelMxForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['mx'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['mx'].queryset = Mx.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class NsForm(ModelForm):
|
class NsForm(ModelForm):
|
||||||
"""Ajout d'un NS pour une zone
|
"""Ajout d'un NS pour une zone
|
||||||
|
@ -356,11 +395,19 @@ class NsForm(ModelForm):
|
||||||
class DelNsForm(Form):
|
class DelNsForm(Form):
|
||||||
"""Suppresion d'un ou plusieurs NS"""
|
"""Suppresion d'un ou plusieurs NS"""
|
||||||
ns = forms.ModelMultipleChoiceField(
|
ns = forms.ModelMultipleChoiceField(
|
||||||
queryset=Ns.objects.all(),
|
queryset=Ns.objects.none(),
|
||||||
label="Enregistrements NS actuels",
|
label="Enregistrements NS actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelNsForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['ns'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['ns'].queryset = Ns.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class TxtForm(ModelForm):
|
class TxtForm(ModelForm):
|
||||||
"""Ajout d'un txt pour une zone"""
|
"""Ajout d'un txt pour une zone"""
|
||||||
|
@ -376,11 +423,19 @@ class TxtForm(ModelForm):
|
||||||
class DelTxtForm(Form):
|
class DelTxtForm(Form):
|
||||||
"""Suppression d'un ou plusieurs TXT"""
|
"""Suppression d'un ou plusieurs TXT"""
|
||||||
txt = forms.ModelMultipleChoiceField(
|
txt = forms.ModelMultipleChoiceField(
|
||||||
queryset=Txt.objects.all(),
|
queryset=Txt.objects.none(),
|
||||||
label="Enregistrements Txt actuels",
|
label="Enregistrements Txt actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelTxtForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['txt'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['txt'].queryset = Txt.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class SrvForm(ModelForm):
|
class SrvForm(ModelForm):
|
||||||
"""Ajout d'un srv pour une zone"""
|
"""Ajout d'un srv pour une zone"""
|
||||||
|
@ -396,11 +451,19 @@ class SrvForm(ModelForm):
|
||||||
class DelSrvForm(Form):
|
class DelSrvForm(Form):
|
||||||
"""Suppression d'un ou plusieurs Srv"""
|
"""Suppression d'un ou plusieurs Srv"""
|
||||||
srv = forms.ModelMultipleChoiceField(
|
srv = forms.ModelMultipleChoiceField(
|
||||||
queryset=Srv.objects.all(),
|
queryset=Srv.objects.none(),
|
||||||
label="Enregistrements Srv actuels",
|
label="Enregistrements Srv actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelSrvForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['srv'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['srv'].queryset = Srv.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class NasForm(ModelForm):
|
class NasForm(ModelForm):
|
||||||
"""Ajout d'un type de nas (machine d'authentification,
|
"""Ajout d'un type de nas (machine d'authentification,
|
||||||
|
@ -417,11 +480,19 @@ class NasForm(ModelForm):
|
||||||
class DelNasForm(Form):
|
class DelNasForm(Form):
|
||||||
"""Suppression d'un ou plusieurs nas"""
|
"""Suppression d'un ou plusieurs nas"""
|
||||||
nas = forms.ModelMultipleChoiceField(
|
nas = forms.ModelMultipleChoiceField(
|
||||||
queryset=Nas.objects.all(),
|
queryset=Nas.objects.none(),
|
||||||
label="Enregistrements Nas actuels",
|
label="Enregistrements Nas actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelNasForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['nas'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['nas'].queryset = Nas.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class ServiceForm(ModelForm):
|
class ServiceForm(ModelForm):
|
||||||
"""Ajout et edition d'une classe de service : dns, dhcp, etc"""
|
"""Ajout et edition d'une classe de service : dns, dhcp, etc"""
|
||||||
|
@ -446,11 +517,19 @@ class ServiceForm(ModelForm):
|
||||||
class DelServiceForm(Form):
|
class DelServiceForm(Form):
|
||||||
"""Suppression d'un ou plusieurs service"""
|
"""Suppression d'un ou plusieurs service"""
|
||||||
service = forms.ModelMultipleChoiceField(
|
service = forms.ModelMultipleChoiceField(
|
||||||
queryset=Service.objects.all(),
|
queryset=Service.objects.none(),
|
||||||
label="Services actuels",
|
label="Services actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelServiceForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['service'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['service'].queryset = Service.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class VlanForm(ModelForm):
|
class VlanForm(ModelForm):
|
||||||
"""Ajout d'un vlan : id, nom"""
|
"""Ajout d'un vlan : id, nom"""
|
||||||
|
@ -466,11 +545,19 @@ class VlanForm(ModelForm):
|
||||||
class DelVlanForm(Form):
|
class DelVlanForm(Form):
|
||||||
"""Suppression d'un ou plusieurs vlans"""
|
"""Suppression d'un ou plusieurs vlans"""
|
||||||
vlan = forms.ModelMultipleChoiceField(
|
vlan = forms.ModelMultipleChoiceField(
|
||||||
queryset=Vlan.objects.all(),
|
queryset=Vlan.objects.none(),
|
||||||
label="Vlan actuels",
|
label="Vlan actuels",
|
||||||
widget=forms.CheckboxSelectMultiple
|
widget=forms.CheckboxSelectMultiple
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
instances = kwargs.pop('instances', None)
|
||||||
|
super(DelVlanForm, self).__init__(*args, **kwargs)
|
||||||
|
if instances:
|
||||||
|
self.fields['vlan'].queryset = instances
|
||||||
|
else:
|
||||||
|
self.fields['vlan'].queryset = Vlan.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class EditOuverturePortConfigForm(ModelForm):
|
class EditOuverturePortConfigForm(ModelForm):
|
||||||
"""Edition de la liste des profils d'ouverture de ports
|
"""Edition de la liste des profils d'ouverture de ports
|
||||||
|
|
|
@ -127,7 +127,8 @@ from re2o.utils import (
|
||||||
can_create,
|
can_create,
|
||||||
can_edit,
|
can_edit,
|
||||||
can_delete,
|
can_delete,
|
||||||
can_view
|
can_view,
|
||||||
|
can_delete_set,
|
||||||
)
|
)
|
||||||
from re2o.views import form
|
from re2o.views import form
|
||||||
|
|
||||||
|
@ -408,10 +409,10 @@ def edit_iptype(request, iptype_instance, iptypeid):
|
||||||
return form({'iptypeform': iptype}, 'machines/machine.html', request)
|
return form({'iptypeform': iptype}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(IpType)
|
||||||
def del_iptype(request):
|
def del_iptype(request, instances):
|
||||||
""" Suppression d'un range ip. Supprime les objets ip associés"""
|
""" Suppression d'un range ip. Supprime les objets ip associés"""
|
||||||
iptype = DelIpTypeForm(request.POST or None)
|
iptype = DelIpTypeForm(request.POST or None, instances=instances)
|
||||||
if iptype.is_valid():
|
if iptype.is_valid():
|
||||||
iptype_dels = iptype.cleaned_data['iptypes']
|
iptype_dels = iptype.cleaned_data['iptypes']
|
||||||
for iptype_del in iptype_dels:
|
for iptype_del in iptype_dels:
|
||||||
|
@ -454,9 +455,9 @@ def edit_machinetype(request, machinetype_instance, machinetypeid):
|
||||||
return form({'machinetypeform': machinetype}, 'machines/machine.html', request)
|
return form({'machinetypeform': machinetype}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(MachineType)
|
||||||
def del_machinetype(request):
|
def del_machinetype(request, instances):
|
||||||
machinetype = DelMachineTypeForm(request.POST or None)
|
machinetype = DelMachineTypeForm(request.POST or None, instances=instances)
|
||||||
if machinetype.is_valid():
|
if machinetype.is_valid():
|
||||||
machinetype_dels = machinetype.cleaned_data['machinetypes']
|
machinetype_dels = machinetype.cleaned_data['machinetypes']
|
||||||
for machinetype_del in machinetype_dels:
|
for machinetype_del in machinetype_dels:
|
||||||
|
@ -499,9 +500,9 @@ def edit_extension(request, extension_instance, extensionid):
|
||||||
return form({'extensionform': extension}, 'machines/machine.html', request)
|
return form({'extensionform': extension}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Extension)
|
||||||
def del_extension(request):
|
def del_extension(request, instances):
|
||||||
extension = DelExtensionForm(request.POST or None)
|
extension = DelExtensionForm(request.POST or None, instances=instances)
|
||||||
if extension.is_valid():
|
if extension.is_valid():
|
||||||
extension_dels = extension.cleaned_data['extensions']
|
extension_dels = extension.cleaned_data['extensions']
|
||||||
for extension_del in extension_dels:
|
for extension_del in extension_dels:
|
||||||
|
@ -544,9 +545,9 @@ def edit_soa(request, soa_instance, soaid):
|
||||||
return form({'soaform': soa}, 'machines/machine.html', request)
|
return form({'soaform': soa}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(SOA)
|
||||||
def del_soa(request):
|
def del_soa(request, instances):
|
||||||
soa = DelSOAForm(request.POST or None)
|
soa = DelSOAForm(request.POST or None, instances=instances)
|
||||||
if soa.is_valid():
|
if soa.is_valid():
|
||||||
soa_dels = soa.cleaned_data['soa']
|
soa_dels = soa.cleaned_data['soa']
|
||||||
for soa_del in soa_dels:
|
for soa_del in soa_dels:
|
||||||
|
@ -589,9 +590,9 @@ def edit_mx(request, mx_instance, mxid):
|
||||||
return form({'mxform': mx}, 'machines/machine.html', request)
|
return form({'mxform': mx}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Mx)
|
||||||
def del_mx(request):
|
def del_mx(request, instances):
|
||||||
mx = DelMxForm(request.POST or None)
|
mx = DelMxForm(request.POST or None, instances=instances)
|
||||||
if mx.is_valid():
|
if mx.is_valid():
|
||||||
mx_dels = mx.cleaned_data['mx']
|
mx_dels = mx.cleaned_data['mx']
|
||||||
for mx_del in mx_dels:
|
for mx_del in mx_dels:
|
||||||
|
@ -634,9 +635,9 @@ def edit_ns(request, ns_instance, nsid):
|
||||||
return form({'nsform': ns}, 'machines/machine.html', request)
|
return form({'nsform': ns}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Ns)
|
||||||
def del_ns(request):
|
def del_ns(request, instances):
|
||||||
ns = DelNsForm(request.POST or None)
|
ns = DelNsForm(request.POST or None, instances=instances)
|
||||||
if ns.is_valid():
|
if ns.is_valid():
|
||||||
ns_dels = ns.cleaned_data['ns']
|
ns_dels = ns.cleaned_data['ns']
|
||||||
for ns_del in ns_dels:
|
for ns_del in ns_dels:
|
||||||
|
@ -679,9 +680,9 @@ def edit_txt(request, txt_instance, txtid):
|
||||||
return form({'txtform': txt}, 'machines/machine.html', request)
|
return form({'txtform': txt}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Txt)
|
||||||
def del_txt(request):
|
def del_txt(request, instances):
|
||||||
txt = DelTxtForm(request.POST or None)
|
txt = DelTxtForm(request.POST or None, instances=instances)
|
||||||
if txt.is_valid():
|
if txt.is_valid():
|
||||||
txt_dels = txt.cleaned_data['txt']
|
txt_dels = txt.cleaned_data['txt']
|
||||||
for txt_del in txt_dels:
|
for txt_del in txt_dels:
|
||||||
|
@ -724,9 +725,9 @@ def edit_srv(request, srv_instance, srvid):
|
||||||
return form({'srvform': srv}, 'machines/machine.html', request)
|
return form({'srvform': srv}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Srv)
|
||||||
def del_srv(request):
|
def del_srv(request, instances):
|
||||||
srv = DelSrvForm(request.POST or None)
|
srv = DelSrvForm(request.POST or None, instances=instances)
|
||||||
if srv.is_valid():
|
if srv.is_valid():
|
||||||
srv_dels = srv.cleaned_data['srv']
|
srv_dels = srv.cleaned_data['srv']
|
||||||
for srv_del in srv_dels:
|
for srv_del in srv_dels:
|
||||||
|
@ -827,9 +828,9 @@ def edit_service(request, service_instance, serviceid):
|
||||||
return form({'serviceform': service}, 'machines/machine.html', request)
|
return form({'serviceform': service}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Service)
|
||||||
def del_service(request):
|
def del_service(request, instances):
|
||||||
service = DelServiceForm(request.POST or None)
|
service = DelServiceForm(request.POST or None, instances=instances)
|
||||||
if service.is_valid():
|
if service.is_valid():
|
||||||
service_dels = service.cleaned_data['service']
|
service_dels = service.cleaned_data['service']
|
||||||
for service_del in service_dels:
|
for service_del in service_dels:
|
||||||
|
@ -872,9 +873,9 @@ def edit_vlan(request, vlan_instance, vlanid):
|
||||||
return form({'vlanform': vlan}, 'machines/machine.html', request)
|
return form({'vlanform': vlan}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Vlan)
|
||||||
def del_vlan(request):
|
def del_vlan(request, instances):
|
||||||
vlan = DelVlanForm(request.POST or None)
|
vlan = DelVlanForm(request.POST or None, instances=instances)
|
||||||
if vlan.is_valid():
|
if vlan.is_valid():
|
||||||
vlan_dels = vlan.cleaned_data['vlan']
|
vlan_dels = vlan.cleaned_data['vlan']
|
||||||
for vlan_del in vlan_dels:
|
for vlan_del in vlan_dels:
|
||||||
|
@ -917,9 +918,9 @@ def edit_nas(request, nas_instance, nasid):
|
||||||
return form({'nasform': nas}, 'machines/machine.html', request)
|
return form({'nasform': nas}, 'machines/machine.html', request)
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('infra')
|
@can_delete_set(Nas)
|
||||||
def del_nas(request):
|
def del_nas(request, instances):
|
||||||
nas = DelNasForm(request.POST or None)
|
nas = DelNasForm(request.POST or None, instances=instances)
|
||||||
if nas.is_valid():
|
if nas.is_valid():
|
||||||
nas_dels = nas.cleaned_data['nas']
|
nas_dels = nas.cleaned_data['nas']
|
||||||
for nas_del in nas_dels:
|
for nas_del in nas_dels:
|
||||||
|
|
Loading…
Reference in a new issue