From ade3427a41cbc25ec2a02ccec5b79f01cecf0329 Mon Sep 17 00:00:00 2001 From: Richard Hill Date: Mon, 6 Jan 2020 16:54:38 +0000 Subject: [PATCH] Don't run validation when value is None for DictFields --- drf_compound_fields/fields.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drf_compound_fields/fields.py b/drf_compound_fields/fields.py index 72aa92e..0fcebee 100755 --- a/drf_compound_fields/fields.py +++ b/drf_compound_fields/fields.py @@ -190,7 +190,7 @@ def validate(self, value): self.validate_is_dict(value) - if self.value_field: + if self.value_field and value is not None: errors = {} for k, v in six.iteritems(value): try: @@ -204,7 +204,7 @@ def validate(self, value): def run_validators(self, value): super(DictField, self).run_validators(value) - if self.value_field: + if self.value_field and value is not None: errors = {} for k, v in six.iteritems(value): try: diff --git a/setup.py b/setup.py index e21c271..c3d6963 100755 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ def run(self): setup( name='drf-compound-fields', - version='0.2.2.post2', + version='0.2.2.post3', description='Django-REST-framework serializer fields for compound types.', long_description=readme + '\n\n' + history, author='Steven Cummings',