Skip to content

Commit ef7aeb7

Browse files
committed
Override value_from_object method to ensure its value is properly coerced.
1 parent 7d9efff commit ef7aeb7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

morango/models/fields/uuids.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def to_python(self, value):
3232
value = super(UUIDField, self).to_python(value)
3333
return value.hex if isinstance(value, uuid.UUID) else value
3434

35+
def value_from_object(self, obj):
36+
return self.to_python(super(UUIDField, self).value_from_object(obj))
37+
3538

3639
class UUIDModelMixin(models.Model):
3740
"""

0 commit comments

Comments
 (0)