Răsfoiți Sursa

Add support for custom field data

jeremystretch 4 ani în urmă
părinte
comite
930ca8d9a1
1 a modificat fișierele cu 8 adăugiri și 1 ștergeri
  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):
     """