Browse Source

Merge pull request #10557 from netbox-community/10556-graphql-display

#10556 add display to GraphQL
Jeremy Stretch 3 years ago
parent
commit
a1cc15a604
1 changed files with 7 additions and 0 deletions
  1. 7 0
      netbox/netbox/graphql/types.py

+ 7 - 0
netbox/netbox/graphql/types.py

@@ -1,3 +1,5 @@
+import graphene
+
 from django.contrib.contenttypes.models import ContentType
 from graphene_django import DjangoObjectType
 
@@ -19,6 +21,11 @@ class BaseObjectType(DjangoObjectType):
     """
     Base GraphQL object type for all NetBox objects. Restricts the model queryset to enforce object permissions.
     """
+    display = graphene.String()
+
+    def resolve_display(parent, info, **kwargs):
+        return str(parent)
+
     class Meta:
         abstract = True