From 6357899b7020762ed2c5b9568a53c25010efe8c7 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sat, 11 Jan 2025 00:47:20 +0800 Subject: [PATCH] Only allow hardcopy requests --- docmanager_backend/document_requests/serializers.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docmanager_backend/document_requests/serializers.py b/docmanager_backend/document_requests/serializers.py index 7374558..2472e16 100644 --- a/docmanager_backend/document_requests/serializers.py +++ b/docmanager_backend/document_requests/serializers.py @@ -42,6 +42,10 @@ class DocumentRequestCreationSerializer(serializers.ModelSerializer): # Set requester to user who sent HTTP request to prevent spoofing validated_data["requester"] = user + if validated_data["type"] == "softcopy": + raise serializers.ValidationError( + {"error": "Hardcopy requests are not accepted as of now"} + ) DOCUMENT_REQUEST = DocumentRequest.objects.create(**validated_data) DOCUMENT_REQUEST_UNITS = []