mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
9856 update imports
This commit is contained in:
parent
de2d9edbd4
commit
7a222a6501
@ -1,4 +1,5 @@
|
|||||||
import strawberry
|
import strawberry
|
||||||
|
import strawberry_django
|
||||||
|
|
||||||
from circuits import filtersets, models
|
from circuits import filtersets, models
|
||||||
from dcim.graphql.mixins import CabledObjectMixin
|
from dcim.graphql.mixins import CabledObjectMixin
|
||||||
@ -17,7 +18,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.Provider,
|
models.Provider,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ProviderFilter
|
filters=ProviderFilter
|
||||||
@ -26,7 +27,7 @@ class ProviderType(NetBoxObjectType, ContactsMixin):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.ProviderAccount,
|
models.ProviderAccount,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ProviderAccountFilter
|
filters=ProviderAccountFilter
|
||||||
@ -35,7 +36,7 @@ class ProviderAccountType(NetBoxObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.ProviderNetwork,
|
models.ProviderNetwork,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ProviderNetworkFilter
|
filters=ProviderNetworkFilter
|
||||||
@ -44,7 +45,7 @@ class ProviderNetworkType(NetBoxObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.CircuitTermination,
|
models.CircuitTermination,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=CircuitTerminationFilter
|
filters=CircuitTerminationFilter
|
||||||
@ -53,7 +54,7 @@ class CircuitTerminationType(CustomFieldsMixin, TagsMixin, CabledObjectMixin, Ob
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.Circuit,
|
models.Circuit,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=CircuitFilter
|
filters=CircuitFilter
|
||||||
@ -62,7 +63,7 @@ class CircuitType(NetBoxObjectType, ContactsMixin):
|
|||||||
provider: ProviderType
|
provider: ProviderType
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.CircuitType,
|
models.CircuitType,
|
||||||
# fields='__all__',
|
# fields='__all__',
|
||||||
exclude=['color',], # bug - remove color from exclude
|
exclude=['color',], # bug - remove color from exclude
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import strawberry
|
import strawberry
|
||||||
|
import strawberry_django
|
||||||
from typing import TYPE_CHECKING, Annotated, List
|
from typing import TYPE_CHECKING, Annotated, List
|
||||||
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
@ -22,7 +23,7 @@ if TYPE_CHECKING:
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class ChangelogMixin:
|
class ChangelogMixin:
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def changelog(self) -> List[Annotated["ObjectChangeType", strawberry.lazy('.types')]]:
|
def changelog(self) -> List[Annotated["ObjectChangeType", strawberry.lazy('.types')]]:
|
||||||
content_type = ContentType.objects.get_for_model(self)
|
content_type = ContentType.objects.get_for_model(self)
|
||||||
object_changes = ObjectChange.objects.filter(
|
object_changes = ObjectChange.objects.filter(
|
||||||
@ -35,7 +36,7 @@ class ChangelogMixin:
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class ConfigContextMixin:
|
class ConfigContextMixin:
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def config_context(self) -> strawberry.scalars.JSON:
|
def config_context(self) -> strawberry.scalars.JSON:
|
||||||
return self.get_config_context()
|
return self.get_config_context()
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ class ConfigContextMixin:
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class CustomFieldsMixin:
|
class CustomFieldsMixin:
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def custom_fields(self) -> strawberry.scalars.JSON:
|
def custom_fields(self) -> strawberry.scalars.JSON:
|
||||||
return self.custom_field_data
|
return self.custom_field_data
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ class CustomFieldsMixin:
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class ImageAttachmentsMixin:
|
class ImageAttachmentsMixin:
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def image_attachments(self) -> List[Annotated["ImageAttachmentType", strawberry.lazy('.types')]]:
|
def image_attachments(self) -> List[Annotated["ImageAttachmentType", strawberry.lazy('.types')]]:
|
||||||
return self.images.restrict(info.context.user, 'view')
|
return self.images.restrict(info.context.user, 'view')
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ class ImageAttachmentsMixin:
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class JournalEntriesMixin:
|
class JournalEntriesMixin:
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def journal_entries(self) -> List[Annotated["JournalEntryType", strawberry.lazy('.types')]]:
|
def journal_entries(self) -> List[Annotated["JournalEntryType", strawberry.lazy('.types')]]:
|
||||||
return self.journal_entries.restrict(info.context.user, 'view')
|
return self.journal_entries.restrict(info.context.user, 'view')
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ class JournalEntriesMixin:
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class TagsMixin:
|
class TagsMixin:
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def tags(self) -> List[Annotated["TagType", strawberry.lazy('.types')]]:
|
def tags(self) -> List[Annotated["TagType", strawberry.lazy('.types')]]:
|
||||||
return self.tags.all()
|
return self.tags.all()
|
||||||
|
|
||||||
@ -75,6 +76,6 @@ class TagsMixin:
|
|||||||
@strawberry.type
|
@strawberry.type
|
||||||
class ContactsMixin:
|
class ContactsMixin:
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def contacts(self) -> List[Annotated["ContactAssignmentType", strawberry.lazy('tenancy.graphql.types')]]:
|
def contacts(self) -> List[Annotated["ContactAssignmentType", strawberry.lazy('tenancy.graphql.types')]]:
|
||||||
return list(self.contacts.all())
|
return list(self.contacts.all())
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import strawberry
|
import strawberry
|
||||||
from strawberry import auto
|
from strawberry import auto
|
||||||
|
import strawberry_django
|
||||||
|
|
||||||
from extras import filtersets, models
|
from extras import filtersets, models
|
||||||
from extras.graphql.mixins import CustomFieldsMixin, TagsMixin
|
from extras.graphql.mixins import CustomFieldsMixin, TagsMixin
|
||||||
@ -23,7 +24,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.ConfigContext,
|
models.ConfigContext,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ConfigContextFilter
|
filters=ConfigContextFilter
|
||||||
@ -32,7 +33,7 @@ class ConfigContextType(ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.ConfigTemplate,
|
models.ConfigTemplate,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ConfigTemplateFilter
|
filters=ConfigTemplateFilter
|
||||||
@ -41,7 +42,7 @@ class ConfigTemplateType(TagsMixin, ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.CustomField,
|
models.CustomField,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=CustomFieldFilter
|
filters=CustomFieldFilter
|
||||||
@ -50,7 +51,7 @@ class CustomFieldType(ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.CustomFieldChoiceSet,
|
models.CustomFieldChoiceSet,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=CustomFieldChoiceSetFilter
|
filters=CustomFieldChoiceSetFilter
|
||||||
@ -59,7 +60,7 @@ class CustomFieldChoiceSetType(ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.CustomLink,
|
models.CustomLink,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=CustomLinkFilter
|
filters=CustomLinkFilter
|
||||||
@ -68,7 +69,7 @@ class CustomLinkType(ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.ExportTemplate,
|
models.ExportTemplate,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ExportTemplateFilter
|
filters=ExportTemplateFilter
|
||||||
@ -77,7 +78,7 @@ class ExportTemplateType(ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.ImageAttachment,
|
models.ImageAttachment,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ImageAttachmentFilter
|
filters=ImageAttachmentFilter
|
||||||
@ -86,7 +87,7 @@ class ImageAttachmentType(BaseObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.JournalEntry,
|
models.JournalEntry,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=JournalEntryFilter
|
filters=JournalEntryFilter
|
||||||
@ -95,7 +96,7 @@ class JournalEntryType(CustomFieldsMixin, TagsMixin, ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.ObjectChange,
|
models.ObjectChange,
|
||||||
fields='__all__',
|
fields='__all__',
|
||||||
filters=ObjectChangeFilter
|
filters=ObjectChangeFilter
|
||||||
@ -104,7 +105,7 @@ class ObjectChangeType(BaseObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.SavedFilter,
|
models.SavedFilter,
|
||||||
exclude=['content_types',],
|
exclude=['content_types',],
|
||||||
filters=SavedFilterFilter
|
filters=SavedFilterFilter
|
||||||
@ -113,7 +114,7 @@ class SavedFilterType(ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.Tag,
|
models.Tag,
|
||||||
exclude=['extras_taggeditem_items', 'color'], # bug - remove color from exclude
|
exclude=['extras_taggeditem_items', 'color'], # bug - remove color from exclude
|
||||||
filters=TagFilter
|
filters=TagFilter
|
||||||
@ -122,7 +123,7 @@ class TagType(ObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.Webhook,
|
models.Webhook,
|
||||||
exclude=['content_types',],
|
exclude=['content_types',],
|
||||||
filters=WebhookFilter
|
filters=WebhookFilter
|
||||||
@ -131,7 +132,7 @@ class WebhookType(OrganizationalObjectType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
models.EventRule,
|
models.EventRule,
|
||||||
exclude=['content_types',],
|
exclude=['content_types',],
|
||||||
filters=EventRuleFilter
|
filters=EventRuleFilter
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import strawberry
|
import strawberry
|
||||||
from strawberry import auto
|
from strawberry import auto
|
||||||
|
import strawberry_django
|
||||||
|
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from extras.graphql.mixins import (
|
from extras.graphql.mixins import (
|
||||||
@ -32,11 +33,11 @@ class BaseObjectType:
|
|||||||
# Enforce object permissions on the queryset
|
# Enforce object permissions on the queryset
|
||||||
return queryset.restrict(info.context.request.user, 'view')
|
return queryset.restrict(info.context.request.user, 'view')
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def display(self) -> str:
|
def display(self) -> str:
|
||||||
return str(self)
|
return str(self)
|
||||||
|
|
||||||
@strawberry.django.field
|
@strawberry_django.field
|
||||||
def class_type(self) -> str:
|
def class_type(self) -> str:
|
||||||
return self.__class__.__name__
|
return self.__class__.__name__
|
||||||
|
|
||||||
@ -80,7 +81,7 @@ class NetBoxObjectType(
|
|||||||
# Miscellaneous types
|
# Miscellaneous types
|
||||||
#
|
#
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
ContentType,
|
ContentType,
|
||||||
fields=['id', 'app_label', 'model'],
|
fields=['id', 'app_label', 'model'],
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import strawberry
|
import strawberry
|
||||||
|
import strawberry_django
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from strawberry import auto
|
from strawberry import auto
|
||||||
@ -12,7 +13,7 @@ __all__ = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
Group,
|
Group,
|
||||||
fields=['id', 'name'],
|
fields=['id', 'name'],
|
||||||
filters=GroupFilter
|
filters=GroupFilter
|
||||||
@ -23,7 +24,7 @@ class GroupType:
|
|||||||
return RestrictedQuerySet(model=Group).restrict(info.context.request.user, 'view')
|
return RestrictedQuerySet(model=Group).restrict(info.context.request.user, 'view')
|
||||||
|
|
||||||
|
|
||||||
@strawberry.django.type(
|
@strawberry_django.type(
|
||||||
get_user_model(),
|
get_user_model(),
|
||||||
fields=[
|
fields=[
|
||||||
'id', 'username', 'password', 'first_name', 'last_name', 'email', 'is_staff',
|
'id', 'username', 'password', 'first_name', 'last_name', 'email', 'is_staff',
|
||||||
|
Loading…
Reference in New Issue
Block a user