From 1dc05a0fe3c1ec87d4a87cc9662fbaefb538bf7f Mon Sep 17 00:00:00 2001 From: EspenAlbert Date: Wed, 25 Nov 2020 08:49:04 +0000 Subject: [PATCH] apply suggestion on adding `model_dict.pop(field, None)`` since the model might be missing the field and that would cause an error. --- ormar/models/modelproxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ormar/models/modelproxy.py b/ormar/models/modelproxy.py index 2ea7ac3..1ae257e 100644 --- a/ormar/models/modelproxy.py +++ b/ormar/models/modelproxy.py @@ -78,7 +78,7 @@ class ModelTableProxy: else: model_dict[field] = field_value.get(target_pkname) else: - model_dict.pop(field) + model_dict.pop(field, None) return model_dict @classmethod