Is There A Way To Upload Files Using The Browsable Api In Django Rest Framework?
I need to test an API that uploads a file. How do I do this from the browsable API. The browsable API page looks like this: Is there any way to upload files using this interface?
Solution 1:
The Django REST framework automatically generates an appropriate form in the browsable API only when using Generic Based views. Switching to Generic Based views solved my problem.
Using the following change I was able to get a file upload field
from rest_framework import generics
classTrainingData(generics.CreateAPIView):
"API for getting the training data"
serializer_class = TrainingSerializer
Post a Comment for "Is There A Way To Upload Files Using The Browsable Api In Django Rest Framework?"