ft_transcendence/profiles/serializers.py

11 lines
349 B
Python
Raw Permalink 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')
avatar_url = serializers.ImageField(required=False)
class Meta:
model = ProfileModel
2023-12-08 11:36:41 -05:00
fields = ["username", "avatar_url", "user_id"]