Skip to content

Commit 9e84547

Browse files
committed
fix coercion
1 parent 0227e0d commit 9e84547

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

django_enum/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def _coerce_to_value_type(self, value: Any) -> Enum:
9191
"""Coerce the value to the enumerations value type"""
9292
# note if enum type is int and a floating point is passed we could get
9393
# situations like X.xxx == X - this is acceptable
94-
if self.enum:
94+
if self.enum and self.primitive:
9595
return self.primitive(value)
9696
# can't ever reach this - just here to make type checker happy
9797
return value # pragma: no cover

0 commit comments

Comments
 (0)