Skip to content

Commit

Permalink
Added nested PrefixList serializer for PrefixListRules
Browse files Browse the repository at this point in the history
  • Loading branch information
Chankster committed Mar 10, 2023
1 parent f04e40f commit e0c4feb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions netbox_bgp/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,17 @@ class Meta:
fields = '__all__'


class NestedPrefixListSerializer(WritableNestedSerializer):
url = HyperlinkedIdentityField(view_name='plugins:netbox_bgp:prefixlist')

class Meta:
model = PrefixList
fields = ("id", "url", "display", "name")


class PrefixListRuleSerializer(NetBoxModelSerializer):
prefix_list = NestedPrefixListSerializer()

class Meta:
model = PrefixListRule
fields = '__all__'

0 comments on commit e0c4feb

Please sign in to comment.