From 6d0932c43615f3368f9e4e53e1258d1ab4b3c403 Mon Sep 17 00:00:00 2001 From: Juho Kettunen Date: Thu, 21 Nov 2024 10:29:13 +0200 Subject: [PATCH] Use more pythonic logic --- leasing/serializers/rent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/leasing/serializers/rent.py b/leasing/serializers/rent.py index 36105ec4..4d86f616 100644 --- a/leasing/serializers/rent.py +++ b/leasing/serializers/rent.py @@ -612,7 +612,7 @@ def validate_override_receivable_type_value( # rent_data before later validations also during the update flow. # Try get ID from the rent instance, which is present if an existing # rent is being updated. - rent_id = self.instance.id if self.instance else None + rent_id = getattr(self.instance, "id", None) if rent_id is not None: self.full_validate_override_receivable_type(