ft_transcendence/profiles/serializers.py

12 lines
400 B
Python
Raw Normal View History

2023-12-06 09:19:41 -05:00
from rest_framework import serializers
from .models import ProfileModel
class ProfileSerializer(serializers.ModelSerializer):
username = serializers.ReadOnlyField(source='user.username')
#creator_id = serializers.ReadOnlyField(source='user.pk')
avatar_url = serializers.ImageField(required=False)
class Meta:
model = ProfileModel
fields = ["username", "avatar_url"]