From e1d7db152582f1e321e5ab6e16ccb915f02a972f Mon Sep 17 00:00:00 2001 From: M1ha Date: Fri, 23 Nov 2018 13:16:35 +0500 Subject: [PATCH] Bugfix --- src/django_clickhouse/serializers.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/django_clickhouse/serializers.py b/src/django_clickhouse/serializers.py index 3c7d7ae..ac0941b 100644 --- a/src/django_clickhouse/serializers.py +++ b/src/django_clickhouse/serializers.py @@ -16,10 +16,13 @@ class Django2ClickHouseModelSerializer: data = model_to_dict(obj, self.serialize_fields, self.exclude_serialize_fields) # Remove None values, they should be initialized as defaults + params = {} for key, value in data.items(): if value is None: - del data[key] + pass elif isinstance(value, bool): - data[key] = int(value) + params[key] = int(value) + else: + params[key] = value - return self._model_cls(**data) + return self._model_cls(**params)