Allow UUIDField to be None when deserializing

This commit is contained in:
ClairePhila 2017-02-10 17:26:02 +01:00 committed by GitHub
parent ab83d4d8fe
commit edad02af06
1 changed files with 2 additions and 0 deletions

View File

@ -2337,6 +2337,8 @@ class UUIDField(Field):
return value.hex
def to_python(self, value):
if value is None:
return None
if not isinstance(value, uuid.UUID):
try:
return uuid.UUID(value)