Skip to content

Commit

Permalink
Revert "Switch empty strings to null when field accepts null"
Browse files Browse the repository at this point in the history
This reverts commit e83dbb1.
  • Loading branch information
stevelacey committed Dec 8, 2021
1 parent 3896302 commit 44d102a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions worf/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ def validate_bundle(self, key):
annotation.output_field if annotation else self.model._meta.get_field(key)
)

if field.null and self.bundle[key] in ["", None]:
self.bundle[key] = None
if field.blank and self.bundle[key] == "":
pass

elif field.blank and self.bundle[key] in ["", None]:
self.bundle[key] = ""
elif field.null and self.bundle[key] is None:
pass

elif hasattr(self, f"validate_{key}"):
self.bundle[key] = getattr(self, f"validate_{key}")(self.bundle[key])
Expand Down

0 comments on commit 44d102a

Please sign in to comment.