From db3d9cb468231c6377417cc383cab6a2c1bd9b8f Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Mon, 26 Dec 2016 19:45:43 +0100 Subject: [PATCH] Fix bug --- machines/forms.py | 4 ++++ search/views.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/machines/forms.py b/machines/forms.py index a0a34c75..99c2c570 100644 --- a/machines/forms.py +++ b/machines/forms.py @@ -154,6 +154,10 @@ class NsForm(ModelForm): model = Ns fields = ['zone', 'ns'] + def __init__(self, *args, **kwargs): + super(NsForm, self).__init__(*args, **kwargs) + self.fields['ns'].queryset = Domain.objects.exclude(interface_parent=None) + class DelNsForm(ModelForm): ns = forms.ModelMultipleChoiceField(queryset=Ns.objects.all(), label="Enregistrements NS actuels", widget=forms.CheckboxSelectMultiple) diff --git a/search/views.py b/search/views.py index 8d5651cc..9402b6b9 100644 --- a/search/views.py +++ b/search/views.py @@ -55,7 +55,7 @@ def search_result(search, type, request): if i == '0': recherche['users_list'] = User.objects.filter((Q(room__name__icontains = search) | Q(pseudo__icontains = search) | Q(name__icontains = search) | Q(surname__icontains = search)) & query1).order_by('state', 'surname') if i == '1': - data = Interface.objects.filter(Q(machine__user__pseudo__icontains = search) | Q(machine__user__name__icontains = search) | Q(machine__user__surname__icontains = search) | Q(mac_address__icontains = search) | Q(ipv4__ipv4__icontains = search)) + data = Interface.objects.filter(Q(machine__user__pseudo__icontains = search) | Q(machine__user__name__icontains = search) | Q(machine__user__surname__icontains = search) | Q(mac_address__icontains = search) | Q(ipv4__ipv4__icontains = search) | Q(domain__name__icontains = search) | Q(domain__related_domain__name__icontains = search)) for d in data: recherche['machines_list'].append(d.machine) if i == '2':