Return display_name in ChoiceField

前端 未结 3 1854
耶瑟儿~
耶瑟儿~ 2021-01-15 03:06

I\'m implementing some REST API in DRF with ModelViewSet and ModelSerializer. All my APIs use the JSON format and some of my models use ChoiceField

3条回答
  •  广开言路
    2021-01-15 03:20

    There's no way other than overriding your serializer. Please take a look here, to see how it can be done.

提交回复
热议问题