-
Notifications
You must be signed in to change notification settings - Fork 53
Update plugin tutorial to align with NetBox 4.0 plugin API changes #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Fixes some of the code segments that relate to the issue netbox-community#36
FWIW, I ran across the following issue in
The following change was enough to fix the problem (at first glance): $ git diff remotes/origin/step09-rest-api -- ':!netbox_access_lists/__init__.py' ':!netbox_access_lists/navigation.py' ':!netbox_access_lists/migrations/0001_initial.py' ':!*.pyc'
diff --git a/netbox_access_lists/api/serializers.py b/netbox_access_lists/api/serializers.py
index 00c509e..4a58a92 100644
--- a/netbox_access_lists/api/serializers.py
+++ b/netbox_access_lists/api/serializers.py
@@ -1,6 +1,6 @@
from rest_framework import serializers
-from ipam.api.serializers import NestedPrefixSerializer
+from ipam.api.serializers import PrefixSerializer
from netbox.api.serializers import NetBoxModelSerializer, WritableNestedSerializer
from ..models import AccessList, AccessListRule
@@ -52,8 +52,8 @@ class AccessListRuleSerializer(NetBoxModelSerializer):
view_name='plugins-api:netbox_access_lists-api:accesslistrule-detail'
)
access_list = NestedAccessListSerializer()
- source_prefix = NestedPrefixSerializer()
- destination_prefix = NestedPrefixSerializer()
+ source_prefix = PrefixSerializer(nested=True)
+ destination_prefix = PrefixSerializer(nested=True)
class Meta:
model = AccessListRule |
I just spent half an hour on this wondering why my buttons weren't showing up, because /AFAICT/ netbox appears to have hidden whatever errors this causes.
|
This tutorial needs some updates to bring it fully into line with the plugin API changes introduced in NetBox 4.0.
As a starting point,
tutorial/step01-initial-setup.md
still instructs the author to import fromextras.plugins
, instead of the newnetbox.plugins
package.Refer to Migrating Your Plugin to NetBox 4.0 in the main NetBox docs for the full set of needed changes.
The text was updated successfully, but these errors were encountered: