|
@@ -11,14 +11,10 @@ from django.core.exceptions import ImproperlyConfigured, ValidationError
|
|
|
from django.core.validators import URLValidator
|
|
from django.core.validators import URLValidator
|
|
|
from django.utils.module_loading import import_string
|
|
from django.utils.module_loading import import_string
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
-from rest_framework.utils import field_mapping
|
|
|
|
|
-from strawberry_django import pagination
|
|
|
|
|
-from strawberry_django.fields.field import StrawberryDjangoField
|
|
|
|
|
|
|
|
|
|
from core.exceptions import IncompatiblePluginError
|
|
from core.exceptions import IncompatiblePluginError
|
|
|
from netbox.config import PARAMS as CONFIG_PARAMS
|
|
from netbox.config import PARAMS as CONFIG_PARAMS
|
|
|
from netbox.constants import RQ_QUEUE_DEFAULT, RQ_QUEUE_HIGH, RQ_QUEUE_LOW
|
|
from netbox.constants import RQ_QUEUE_DEFAULT, RQ_QUEUE_HIGH, RQ_QUEUE_LOW
|
|
|
-from netbox.graphql.pagination import OffsetPaginationInput, apply_pagination
|
|
|
|
|
from netbox.plugins import PluginConfig
|
|
from netbox.plugins import PluginConfig
|
|
|
from netbox.registry import registry
|
|
from netbox.registry import registry
|
|
|
import storages.utils # type: ignore
|
|
import storages.utils # type: ignore
|
|
@@ -28,21 +24,6 @@ from utilities.string import trailing_slash
|
|
|
from .monkey import get_unique_validators
|
|
from .monkey import get_unique_validators
|
|
|
|
|
|
|
|
|
|
|
|
|
-#
|
|
|
|
|
-# Monkey-patching
|
|
|
|
|
-#
|
|
|
|
|
-
|
|
|
|
|
-# TODO: Remove this once #20547 has been implemented
|
|
|
|
|
-# Override DRF's get_unique_validators() function with our own (see bug #19302)
|
|
|
|
|
-field_mapping.get_unique_validators = get_unique_validators
|
|
|
|
|
-
|
|
|
|
|
-# Override strawberry-django's OffsetPaginationInput class to add the `start` parameter
|
|
|
|
|
-pagination.OffsetPaginationInput = OffsetPaginationInput
|
|
|
|
|
-
|
|
|
|
|
-# Patch StrawberryDjangoField to use our custom `apply_pagination()` method with support for cursor-based pagination
|
|
|
|
|
-StrawberryDjangoField.apply_pagination = apply_pagination
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
#
|
|
#
|
|
|
# Environment setup
|
|
# Environment setup
|
|
|
#
|
|
#
|
|
@@ -969,6 +950,26 @@ for plugin_name in PLUGINS:
|
|
|
raise ImproperlyConfigured(f"events_pipline in plugin: {plugin_name} must be a list or tuple")
|
|
raise ImproperlyConfigured(f"events_pipline in plugin: {plugin_name} must be a list or tuple")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+#
|
|
|
|
|
+# Monkey-patching
|
|
|
|
|
+#
|
|
|
|
|
+
|
|
|
|
|
+from rest_framework.utils import field_mapping # noqa: E402
|
|
|
|
|
+from strawberry_django import pagination # noqa: E402
|
|
|
|
|
+from strawberry_django.fields.field import StrawberryDjangoField # noqa: E402
|
|
|
|
|
+from netbox.graphql.pagination import OffsetPaginationInput, apply_pagination # noqa: E402
|
|
|
|
|
+
|
|
|
|
|
+# TODO: Remove this once #20547 has been implemented
|
|
|
|
|
+# Override DRF's get_unique_validators() function with our own (see bug #19302)
|
|
|
|
|
+field_mapping.get_unique_validators = get_unique_validators
|
|
|
|
|
+
|
|
|
|
|
+# Override strawberry-django's OffsetPaginationInput class to add the `start` parameter
|
|
|
|
|
+pagination.OffsetPaginationInput = OffsetPaginationInput
|
|
|
|
|
+
|
|
|
|
|
+# Patch StrawberryDjangoField to use our custom `apply_pagination()` method with support for cursor-based pagination
|
|
|
|
|
+StrawberryDjangoField.apply_pagination = apply_pagination
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
# UNSUPPORTED FUNCTIONALITY: Import any local overrides.
|
|
# UNSUPPORTED FUNCTIONALITY: Import any local overrides.
|
|
|
try:
|
|
try:
|
|
|
from .local_settings import *
|
|
from .local_settings import *
|