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

Add changelog GraphQL relation for changelogged models

This commit is contained in:
jeremystretch
2021-08-03 14:51:56 -04:00
parent 1518a460d5
commit 88d2441ab3
6 changed files with 49 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ import graphene
from graphene.types.generic import GenericScalar
__all__ = (
'ChangelogMixin',
'CustomFieldsMixin',
'ImageAttachmentsMixin',
'JournalEntriesMixin',
@@ -9,6 +10,13 @@ __all__ = (
)
class ChangelogMixin:
changelog = graphene.List('extras.graphql.types.ObjectChangeType')
def resolve_changelog(self, info):
return self.object_changes.restrict(info.context.user, 'view')
class CustomFieldsMixin:
custom_fields = GenericScalar()