Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from depop/fix-dictfield-validation
Browse files Browse the repository at this point in the history
Don't run validation when value is None for DictFields
  • Loading branch information
richardhill-depop authored Jan 6, 2020
2 parents 4044cdc + ade3427 commit 10f5c0d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drf_compound_fields/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 10f5c0d

Please sign in to comment.