K
K
Kaga882020-07-18 16:17:55
Django
Kaga88, 2020-07-18 16:17:55

How to execute logic without saving to Django Django REST framework DB?

Please tell me the best way to solve the following:
In DRF we accept a POST request with a file => perform various manipulations with the file, resulting in a regular JSON object => return a response with JSON. The database is not involved in this process.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2020-07-18
@Kaga88

and what is the problem? read about APIView

_
_, 2020-07-18
@mrxor

Use GenericAPIView
And if you need to just return your json do

from rest_framework.response import Response
....
return Response(data, status=status.HTTP_200_OK)

where data is a dictionary with your data, here you can do without a serializer

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question