3

I would like to add descriptions of parameters in Django Documentation. I am trying in the way shown below, however it doesn't work. Any suggestions?

    @permission_classes([UserPermission])
    class ObjectByID(GenericAPIView):

        """
        get: Return object by ID.
        put: Update object by ID.
        delete: Delete object by ID.
        Parameters:
          object_id - parameter description.
        """

        serializer_class = ObjectSerializer

        def get(self, request, object_id):

            try:
                object = Object.objects.get(id= object_id)
            except Object.DoesNotExist:
                return Response(status=status.HTTP_404_NOT_FOUND)
            serializer = ObjectSerializer(object)
            return Response(serializer.data)

...
  • 2
    Please explain why it doesn't work and the expected behavior. [ask] – Alexander Aug 18 '17 at 19:31
  • @Alexander If I knew why it did not work I would write it. Expected behavior is to have descriptions of parameters in Django Documentation what is written in the question. –  Aug 18 '17 at 20:23
  • Possible duplicate of [What is the standard Python docstring format?](https://stackoverflow.com/questions/3898572/what-is-the-standard-python-docstring-format) – Marshall X Aug 18 '17 at 21:11
  • @MarshallX but which format is recommended for Django Rest Framework? –  Aug 19 '17 at 09:35

0 Answers0