mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-16 00:13:12 +00:00
Merge branch 'fix_del_ns' into 'master'
Fix del ns See merge request federez/re2o!480
This commit is contained in:
commit
cb999b260c
2 changed files with 7 additions and 7 deletions
|
@ -400,7 +400,7 @@ class NsForm(FormRevMixin, ModelForm):
|
||||||
class DelNsForm(FormRevMixin, Form):
|
class DelNsForm(FormRevMixin, Form):
|
||||||
"""Suppresion d'un ou plusieurs NS"""
|
"""Suppresion d'un ou plusieurs NS"""
|
||||||
|
|
||||||
ns = forms.ModelMultipleChoiceField(
|
nss = forms.ModelMultipleChoiceField(
|
||||||
queryset=Ns.objects.none(),
|
queryset=Ns.objects.none(),
|
||||||
label=_("Current NS records"),
|
label=_("Current NS records"),
|
||||||
widget=forms.CheckboxSelectMultiple,
|
widget=forms.CheckboxSelectMultiple,
|
||||||
|
@ -410,9 +410,9 @@ class DelNsForm(FormRevMixin, Form):
|
||||||
instances = kwargs.pop("instances", None)
|
instances = kwargs.pop("instances", None)
|
||||||
super(DelNsForm, self).__init__(*args, **kwargs)
|
super(DelNsForm, self).__init__(*args, **kwargs)
|
||||||
if instances:
|
if instances:
|
||||||
self.fields["ns"].queryset = instances
|
self.fields["nss"].queryset = instances
|
||||||
else:
|
else:
|
||||||
self.fields["ns"].queryset = Ns.objects.all()
|
self.fields["nss"].queryset = Ns.objects.all()
|
||||||
|
|
||||||
|
|
||||||
class TxtForm(FormRevMixin, ModelForm):
|
class TxtForm(FormRevMixin, ModelForm):
|
||||||
|
|
|
@ -817,9 +817,9 @@ def edit_ns(request, ns_instance, **_kwargs):
|
||||||
@can_delete_set(Ns)
|
@can_delete_set(Ns)
|
||||||
def del_ns(request, instances):
|
def del_ns(request, instances):
|
||||||
""" View used to delete a NS object """
|
""" View used to delete a NS object """
|
||||||
ns = DelNsForm(request.POST or None, instances=instances)
|
nss = DelNsForm(request.POST or None, instances=instances)
|
||||||
if ns.is_valid():
|
if nss.is_valid():
|
||||||
ns_dels = ns.cleaned_data["ns"]
|
ns_dels = nss.cleaned_data["nss"]
|
||||||
for ns_del in ns_dels:
|
for ns_del in ns_dels:
|
||||||
try:
|
try:
|
||||||
ns_del.delete()
|
ns_del.delete()
|
||||||
|
@ -830,7 +830,7 @@ def del_ns(request, instances):
|
||||||
)
|
)
|
||||||
return redirect(reverse("machines:index-extension"))
|
return redirect(reverse("machines:index-extension"))
|
||||||
return form(
|
return form(
|
||||||
{"nsform": ns, "action_name": _("Delete")}, "machines/machine.html", request
|
{"nsform": nss, "action_name": _("Delete")}, "machines/machine.html", request
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue