From cdb4d733731d7419f0bde2f24cb8a1dca88e9050 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Fri, 24 Jan 2020 21:37:24 +0100 Subject: [PATCH] Fix conflicting variable names (ns vs nss) --- machines/forms.py | 6 +++--- machines/views.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/machines/forms.py b/machines/forms.py index 80379bc3..7217c4d7 100644 --- a/machines/forms.py +++ b/machines/forms.py @@ -400,7 +400,7 @@ class NsForm(FormRevMixin, ModelForm): class DelNsForm(FormRevMixin, Form): """Suppresion d'un ou plusieurs NS""" - ns = forms.ModelMultipleChoiceField( + nss = forms.ModelMultipleChoiceField( queryset=Ns.objects.none(), label=_("Current NS records"), widget=forms.CheckboxSelectMultiple, @@ -410,9 +410,9 @@ class DelNsForm(FormRevMixin, Form): instances = kwargs.pop("instances", None) super(DelNsForm, self).__init__(*args, **kwargs) if instances: - self.fields["ns"].queryset = instances + self.fields["nss"].queryset = instances else: - self.fields["ns"].queryset = Ns.objects.all() + self.fields["nss"].queryset = Ns.objects.all() class TxtForm(FormRevMixin, ModelForm): diff --git a/machines/views.py b/machines/views.py index c308764d..8f70d187 100644 --- a/machines/views.py +++ b/machines/views.py @@ -817,9 +817,9 @@ def edit_ns(request, ns_instance, **_kwargs): @can_delete_set(Ns) def del_ns(request, instances): """ View used to delete a NS object """ - ns = DelNsForm(request.POST or None, instances=instances) - if ns.is_valid(): - ns_dels = ns.cleaned_data["ns"] + nss = DelNsForm(request.POST or None, instances=instances) + if nss.is_valid(): + ns_dels = nss.cleaned_data["nss"] for ns_del in ns_dels: try: ns_del.delete() @@ -830,7 +830,7 @@ def del_ns(request, instances): ) return redirect(reverse("machines:index-extension")) return form( - {"nsform": ns, "action_name": _("Delete")}, "machines/machine.html", request + {"nsform": nss, "action_name": _("Delete")}, "machines/machine.html", request )