From def1bc5adee34d13f0b262131e1a8ec66dd9e6f4 Mon Sep 17 00:00:00 2001 From: Zach Taylor Date: Mon, 19 Oct 2020 14:45:29 -0500 Subject: [PATCH] Allow attribute_value to be None if enum type --- eav/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eav/models.py b/eav/models.py index 3321616..4a441d5 100644 --- a/eav/models.py +++ b/eav/models.py @@ -529,7 +529,8 @@ class Entity(object): if self._hasattr(attribute.slug): attribute_value = self._getattr(attribute.slug) if attribute.datatype == Attribute.TYPE_ENUM and not isinstance(attribute_value, EnumValue): - attribute_value = EnumValue.objects.get(value=attribute_value) + if attribute_value is not None: + attribute_value = EnumValue.objects.get(value=attribute_value) attribute.save_value(self.instance, attribute_value) def validate_attributes(self):