From 797d6c8406d927d4f9f2449dcaddc4e38e1f614c Mon Sep 17 00:00:00 2001 From: Jonas Metzener Date: Fri, 29 Nov 2024 11:32:13 +0100 Subject: [PATCH] chore(debug): only print json-api information in debug mode --- generic_permissions/visibilities.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generic_permissions/visibilities.py b/generic_permissions/visibilities.py index a655981..ebbd522 100644 --- a/generic_permissions/visibilities.py +++ b/generic_permissions/visibilities.py @@ -1,6 +1,7 @@ from functools import reduce from warnings import warn +from django.conf import settings from rest_framework.relations import MANY_RELATION_KWARGS, ManyRelatedField from rest_framework.serializers import PrimaryKeyRelatedField @@ -166,9 +167,10 @@ class VisibilitySerializerMethodResourceRelatedField( pass except ModuleNotFoundError: # pragma: no cover - print( - "django-rest-framework-json-api is not installed. Skipping django-rest-framework-json-api related imports." - ) + if settings.DEBUG: + print( + "django-rest-framework-json-api is not installed. Skipping django-rest-framework-json-api related imports." + ) class BaseVisibility: # pragma: no cover