Developing API with Django REST Framework is so easy. So I was looking for the simple way to quickly document API methods with short descriptions. What I found that it can be done incredibly simple.

You just document views by including docstrings. Describe each included method in docstring. For example:

class ListingViewSet(mixins.CreateModelMixin,
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
mixins.DestroyModelMixin,
viewsets.GenericViewSet):
"""
General ViewSet description

create:
Create listing object with initial data.

retrieve:
Return the given listing.

update:
Update listing object.

partial_update:
Patch listing object.

destroy:
Delete listing object
"""
permission_classes = [IsAuthenticated]
serializer_class = ListingSerializer
queryset = Listings.objects.all()

Here is result (drf-yasg):

Roman Krasniak

Python\Django Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store