11 lines
349 B
Python
11 lines
349 B
Python
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
|
|
fields = ["username", "avatar_url", "user_id"] |