diff --git a/djangochannelsrestframework/observer/model_observer.py b/djangochannelsrestframework/observer/model_observer.py index d9bd7c5..4222f64 100644 --- a/djangochannelsrestframework/observer/model_observer.py +++ b/djangochannelsrestframework/observer/model_observer.py @@ -182,6 +182,10 @@ def serialize(self, instance, action, **kwargs) -> Dict[str, Any]: else: message_body["pk"] = instance.pk + # Check if the pk of the model is UUID type and convert it to a string + if isinstance(message_body['pk'], UUID): + message_body.update({'pk': str(message_body['pk'])}) + message = dict( type=self.func.__name__.replace("_", "."), body=message_body,