Django serializer inherit and extend fields

Solution 1:

You can do:

class BasicSerializer(serializers.ModelSerializer):
    class Meta:
         model = MyModel
         fields = ('lengthy', 'touple', 'of', 'fields', 'like', '10', 'of', 'them')

class AdvandedSerializer(BasicSerializer):
    additional_field = serializers.SerializerMethodField()

    def get_additional_field(self, obj):
        return('not important')

    class Meta(BasicSerializer.Meta):
        fields = BasicSerializer.Meta.fields + ('additional_field',)

Solution 2:

we can do like

class AdvandedSerializer(BasicSerializer):
    # ... some code

    class Meta:
         model = MyModel
         fields = BasicSerializer.Meta.fields + ('additional_field',)