From edad02af06abd11e8a4753b150197d3c7b421774 Mon Sep 17 00:00:00 2001 From: ClairePhila Date: Fri, 10 Feb 2017 17:26:02 +0100 Subject: [PATCH] Allow UUIDField to be None when deserializing --- django/db/models/fields/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 527ed8e423..e5dc5e9e8a 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -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)