1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-20 21:39:37 +02:00
AdventureLog/backend/server/main/utils.py

10 lines
351 B
Python
Raw Normal View History

from rest_framework import serializers
def get_user_uuid(user):
return str(user.uuid)
class CustomModelSerializer(serializers.ModelSerializer):
def to_representation(self, instance):
representation = super().to_representation(instance)
representation['user_id'] = get_user_uuid(instance.user_id)
return representation