Fix error with questionnaire submissions not tied to requests

This commit is contained in:
Keannu Bernasol 2024-12-18 23:13:56 +08:00
parent 6f276b43cc
commit 75d62014fb

View file

@ -69,7 +69,10 @@ class QuestionnaireSerializer(serializers.ModelSerializer):
)
if "document_request" in validated_data:
if validated_data["document_request"]:
document_request_id = validated_data["document_request"].id
else:
document_request_id = None
del validated_data["document_request"]
instance = self.Meta.model(**validated_data)