restore uuid check for fk

This commit is contained in:
collerek
2021-03-09 20:49:20 +01:00
parent 082405d8ef
commit 869f4d9d97

View File

@ -399,6 +399,8 @@ class ForeignKeyField(BaseField):
:return: (if needed) registered Model
:rtype: Model
"""
if cls.to.pk_type() == uuid.UUID and isinstance(value, str):
value = uuid.UUID(value)
if not isinstance(value, cls.to.pk_type()):
raise RelationshipInstanceError(
f"Relationship error - ForeignKey {cls.to.__name__} "