Allow UUIDField to be None when deserializing
This commit is contained in:
parent
ab83d4d8fe
commit
edad02af06
|
@ -2337,6 +2337,8 @@ class UUIDField(Field):
|
||||||
return value.hex
|
return value.hex
|
||||||
|
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
if not isinstance(value, uuid.UUID):
|
if not isinstance(value, uuid.UUID):
|
||||||
try:
|
try:
|
||||||
return uuid.UUID(value)
|
return uuid.UUID(value)
|
||||||
|
|
Loading…
Reference in New Issue