Skip to content

Commit

Permalink
Merge pull request #333 from digitalocean/secrets-api-filter
Browse files Browse the repository at this point in the history
Fixes #332 - Add device filter to secrets api.
  • Loading branch information
jeremystretch authored Jul 19, 2016
2 parents 7833410 + c9dc6d0 commit 50d2065
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion netbox/secrets/filters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import django_filters

from .models import Secret, SecretRole
from dcim.models import Device


class SecretFilter(django_filters.FilterSet):
Expand All @@ -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']

0 comments on commit 50d2065

Please sign in to comment.