From 79356a11e12e3bef57e3a14273e220569d4b0ae7 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Sat, 22 Jul 2023 07:54:50 +0000 Subject: [PATCH] Pop "patient_category" in local `validated_data` instead of `self.validated_data` (#1471) fixes #1470, pop in local `validated_data` --- care/facility/api/serializers/shifting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/care/facility/api/serializers/shifting.py b/care/facility/api/serializers/shifting.py index 21b8b5c458..8be8fc8863 100644 --- a/care/facility/api/serializers/shifting.py +++ b/care/facility/api/serializers/shifting.py @@ -329,7 +329,7 @@ def update(self, instance, validated_data): new_instance = super().update(instance, validated_data) patient = new_instance.patient - patient_category = self.validated_data.pop("patient_category") + patient_category = validated_data.pop("patient_category") if patient.last_consultation and patient_category is not None: patient.last_consultation.category = patient_category patient.last_consultation.save(update_fields=["category"]) @@ -394,7 +394,7 @@ def create(self, validated_data): patient.allow_transfer = True patient.save() - patient_category = self.validated_data.pop("patient_category") + patient_category = validated_data.pop("patient_category") if patient.last_consultation and patient_category is not None: patient.last_consultation.category = patient_category patient.last_consultation.save(update_fields=["category"])