[Fixed]-Can I modify field type in serializer for ModelSerializers?

1👍

By specifying the source parameter, you can rename fields from your model to anything you would like.

class ProfileSerializer(serializers.ModelSerializer):
    some_other_name = serializers.ImageField(source='profile_picture')

    class Meta:
        model = Profile
        fields = ('some_other_name',)

Leave a comment