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

Move CustomFieldModelViewSet functionality into NetBoxModelViewSet

This commit is contained in:
jeremystretch
2022-03-09 11:44:55 -05:00
parent efd5a73a18
commit bbdeae0ed9
8 changed files with 69 additions and 74 deletions

View File

@ -76,24 +76,6 @@ class CustomFieldViewSet(NetBoxModelViewSet):
filterset_class = filtersets.CustomFieldFilterSet
class CustomFieldModelViewSet(NetBoxModelViewSet):
"""
Include the applicable set of CustomFields in the ModelViewSet context.
"""
def get_serializer_context(self):
# Gather all custom fields for the model
content_type = ContentType.objects.get_for_model(self.queryset.model)
custom_fields = content_type.custom_fields.all()
context = super().get_serializer_context()
context.update({
'custom_fields': custom_fields,
})
return context
#
# Custom links
#