mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
9478 add class_type
This commit is contained in:
parent
7d976f0477
commit
5de5422ad7
@ -1,8 +1,13 @@
|
||||
import graphene
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from extras.graphql.mixins import (
|
||||
ChangelogMixin,
|
||||
CustomFieldsMixin,
|
||||
JournalEntriesMixin,
|
||||
TagsMixin,
|
||||
)
|
||||
from graphene_django import DjangoObjectType
|
||||
|
||||
from extras.graphql.mixins import ChangelogMixin, CustomFieldsMixin, JournalEntriesMixin, TagsMixin
|
||||
|
||||
__all__ = (
|
||||
'BaseObjectType',
|
||||
'ObjectType',
|
||||
@ -19,6 +24,8 @@ class BaseObjectType(DjangoObjectType):
|
||||
"""
|
||||
Base GraphQL object type for all NetBox objects. Restricts the model queryset to enforce object permissions.
|
||||
"""
|
||||
class_type = graphene.String()
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
@ -27,6 +34,9 @@ class BaseObjectType(DjangoObjectType):
|
||||
# Enforce object permissions on the queryset
|
||||
return queryset.restrict(info.context.user, 'view')
|
||||
|
||||
def resolve_class_type(parent, info, **kwargs):
|
||||
return parent.__class__.__name__
|
||||
|
||||
|
||||
class ObjectType(
|
||||
ChangelogMixin,
|
||||
|
Loading…
Reference in New Issue
Block a user