Skip to content

Commit

Permalink
Override value_from_object method to ensure its value is properly coe…
Browse files Browse the repository at this point in the history
…rced.
  • Loading branch information
rtibbles committed Apr 28, 2022
1 parent 7d9efff commit e48341a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions morango/models/fields/uuids.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def to_python(self, value):
value = super(UUIDField, self).to_python(value)
return value.hex if isinstance(value, uuid.UUID) else value

def value_from_object(self, obj):
return self.to_python(super().value_from_object(obj))


class UUIDModelMixin(models.Model):
"""
Expand Down

0 comments on commit e48341a

Please sign in to comment.