[Answered ]-Property method and other methods in django models

1👍

Pass the source parameter to a serializer field to access a method on the model, the method must take only a single self parameter

class PersonSerializer(serializers.ModelSerializer):

    foo = serializers.CharField(source='baby_boomer_status', read_only=True)

    class Meta:
        model = Person
        fields = ['field_a', 'field_b']

Leave a comment