Django

Convert boolean True and False field value in Django Rest Framework

29 Mar , 2015  

Here is a quick snippet to convert boolean True / False in DRF Serializer:

1
2
3
4
5
6
is_finish = serializers.SerializerMethodField()

def get_is_finish(self, obj):
    if obj.is_finish:
        return "Selesai"
    return "Progress"


Leave a Reply

Your email address will not be published. Required fields are marked *