From ea5962be2545111eedb3cc15e144662f973f69f1 Mon Sep 17 00:00:00 2001 From: Peter Eckel Date: Sat, 17 Aug 2024 00:25:18 +0200 Subject: [PATCH] Fixed API widget for Prefix assignment to View objects --- netbox_dns/api/views.py | 2 ++ netbox_dns/fields/ipam.py | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/netbox_dns/api/views.py b/netbox_dns/api/views.py index 5566fda0..65983bbf 100644 --- a/netbox_dns/api/views.py +++ b/netbox_dns/api/views.py @@ -4,6 +4,7 @@ from rest_framework.routers import APIRootView from ipam.models import Prefix +from ipam.filtersets import PrefixFilterSet from netbox.api.viewsets import NetBoxModelViewSet @@ -160,3 +161,4 @@ class RecordTemplateViewSet(NetBoxModelViewSet): class PrefixViewSet(NetBoxModelViewSet): queryset = Prefix.objects.all() serializer_class = PrefixSerializer + filterset_class = PrefixFilterSet diff --git a/netbox_dns/fields/ipam.py b/netbox_dns/fields/ipam.py index 26320870..d85d6229 100644 --- a/netbox_dns/fields/ipam.py +++ b/netbox_dns/fields/ipam.py @@ -6,9 +6,6 @@ class PrefixDynamicModelMultipleChoiceField(DynamicModelMultipleChoiceField): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - widget = APISelectMultiple(api_url="/api/plugins/netbox-dns/prefixes") def label_from_instance(self, obj):