From 293eb7a59a31118ceac713111ce1492520f2039d Mon Sep 17 00:00:00 2001 From: rw-bsi Date: Fri, 6 Dec 2024 15:17:26 +0000 Subject: [PATCH] fix for DRF API access --- backend/apps/ifc_validation/serializers.py | 5 +++-- backend/core/settings.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/apps/ifc_validation/serializers.py b/backend/apps/ifc_validation/serializers.py index 19c135c..b76547d 100644 --- a/backend/apps/ifc_validation/serializers.py +++ b/backend/apps/ifc_validation/serializers.py @@ -5,7 +5,7 @@ from apps.ifc_validation_models.models import ValidationOutcome -class BaseSerializer(serializers.HyperlinkedModelSerializer): +class BaseSerializer(serializers.ModelSerializer): def get_field_names(self, declared_fields, info): @@ -28,7 +28,8 @@ class Meta: model = ValidationRequest fields = '__all__' show = ["public_id", "model_public_id"] - hide = ["id", "model"] + hide = ["id"] + read_only_fields = ['size', 'created_by'] class ValidationTaskSerializer(BaseSerializer): diff --git a/backend/core/settings.py b/backend/core/settings.py index ce1d9af..8ad5714 100644 --- a/backend/core/settings.py +++ b/backend/core/settings.py @@ -134,7 +134,11 @@ 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.BasicAuthentication', 'rest_framework.authentication.SessionAuthentication', - ] + 'rest_framework.authentication.TokenAuthentication', + ], + 'DEFAULT_PERMISSION_CLASSES':( + 'rest_framework.permissions.IsAuthenticated', + ), } SPECTACULAR_SETTINGS = {