def to_representation(self, instance):
tags = instance.tags.all()
tags_fields_to_representation = [
{
'name': tag.name,
'color': tag.color,
'slug': tag.slug
} for tag in tags]
representation = super().to_representation(instance)
if instance.tags:
representation['tags'] = tags_fields_to_representation
return representation