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:
@@ -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()
|
||||
|
||||
|
Reference in New Issue
Block a user