Просмотр исходного кода

Add support for custom field data

jeremystretch 4 лет назад
Родитель
Сommit
930ca8d9a1
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      netbox/netbox/graphql/types.py

+ 8 - 1
netbox/netbox/graphql/types.py

@@ -1,4 +1,5 @@
 import graphene
+from graphene.types.generic import GenericScalar
 from graphene_django import DjangoObjectType
 
 __all__ = (
@@ -22,11 +23,17 @@ class BaseObjectType(DjangoObjectType):
 
 
 class ObjectType(BaseObjectType):
-    # TODO: Custom fields support
+    """
+    Extends BaseObjectType with support for custom field data.
+    """
+    custom_fields = GenericScalar()
 
     class Meta:
         abstract = True
 
+    def resolve_custom_fields(self, info):
+        return self.custom_field_data
+
 
 class TaggedObjectType(ObjectType):
     """