[Answer]-Have a specific docstring for each methods in @action, Django-REST-framework

1👍

Any method may have only one docstring, so generally you have two options:

  1. You can define a single docstring to the followers method and explain how method behaves accordingly to the method. This option is suitable if you are sure that the business logic of the different HTTP methods is not too complex.

  2. Define separate methods for different request types, so that they could have separate docstrings. This will allow you to keep the logic inside each method as simple as possible.

You can also consider returning an object that has separate methods representing the HTTP methods and calling them accordingly.

Leave a comment