Allow attribute_value to be None if enum type

This commit is contained in:
Zach Taylor 2020-10-19 14:45:29 -05:00
parent 1f629506a8
commit def1bc5ade

View file

@ -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):