From c9dc6d04ef676604cd06fca166e9ff6459777742 Mon Sep 17 00:00:00 2001 From: Zach Moody Date: Mon, 18 Jul 2016 17:53:47 -0500 Subject: [PATCH] Fixes #332 - Add device filter to secrets api. --- netbox/secrets/filters.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/netbox/secrets/filters.py b/netbox/secrets/filters.py index 0773562e641..4606b3db5b9 100644 --- a/netbox/secrets/filters.py +++ b/netbox/secrets/filters.py @@ -1,6 +1,7 @@ import django_filters from .models import Secret, SecretRole +from dcim.models import Device class SecretFilter(django_filters.FilterSet): @@ -15,7 +16,13 @@ class SecretFilter(django_filters.FilterSet): to_field_name='slug', label='Role (slug)', ) + device = django_filters.ModelMultipleChoiceFilter( + name='device', + queryset=Device.objects.all(), + to_field_name='name', + label='Device (Name)', + ) class Meta: model = Secret - fields = ['name', 'role_id', 'role'] + fields = ['name', 'role_id', 'role', 'device']