django-rest-framework - autogenerate form in browsable API?

前端 未结 3 1339
北荒
北荒 2021-01-04 10:19

Not sure if i\'m using the right vocabulary. In the browsable api that comes for free with django-rest-framework, I was wondering if there was a way to autogenerate a form s

3条回答
  •  旧巷少年郎
    2021-01-04 10:51

    class MyApiView(APIView):
        """My Demo API View"""
        serializer_class = serializers.MySerializers
    

    Make sure you're using the name "serializer_class" and not any other name like serializers_class.

    using the exact "serializer_class" will autogenerate form in the browseable API

提交回复
热议问题