1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #8274: Enable associating a custom link with multiple object types

This commit is contained in:
jeremystretch
2022-10-26 11:33:11 -04:00
parent c4dcd34ce9
commit 9e8234bb45
16 changed files with 94 additions and 51 deletions

View File

@ -117,14 +117,15 @@ class CustomFieldSerializer(ValidatedModelSerializer):
class CustomLinkSerializer(ValidatedModelSerializer):
url = serializers.HyperlinkedIdentityField(view_name='extras-api:customlink-detail')
content_type = ContentTypeField(
queryset=ContentType.objects.filter(FeatureQuery('custom_links').get_query())
content_types = ContentTypeField(
queryset=ContentType.objects.filter(FeatureQuery('custom_links').get_query()),
many=True
)
class Meta:
model = CustomLink
fields = [
'id', 'url', 'display', 'content_type', 'name', 'enabled', 'link_text', 'link_url', 'weight', 'group_name',
'id', 'url', 'display', 'content_types', 'name', 'enabled', 'link_text', 'link_url', 'weight', 'group_name',
'button_class', 'new_window', 'created', 'last_updated',
]