I'm using Django REST Framework (3.9.4) and django-rest-swagger (2.2)

In view.py I'm using generic class-based views such as generics.ListCreateAPIView and generics.RetrieveUpdateDestroyAPIView

In swagger page it's enlisting correctly all API with their corresponding method calls.

When It's an API call for PUT, for {id} it's asking to provide input in an input box. But for request-body it's asking to provide the whole Json as an input.

I want to change it such a way that for all request-body parameters, each of them will come as an individual input-box similar to id field of header ( kind of we see in Browsable API display)

How can I do that?

enter image description here

1

There are 1 best solutions below

0
SamCodes On

In settings.py along with

 SWAGGER_SETTINGS =

      {            
       'JSON_EDITOR': True,        
      }

also added parsers in this particular order in REST Framework setting:

  'DEFAULT_PARSER_CLASSES': (
          'rest_framework.parsers.FormParser',
          'rest_framework.parsers.MultiPartParser',
          'rest_framework.parsers.JSONParser',
   )