Skip to content
Advertisement

Tag: django-rest-framework

Django rest framework’s StringRelatedField is throwing KeyError

I have the following model classes. and I have imported these classes as following as they are located in a separate package and this is my serializer class and views is and url has the following I am getting the following error I looked into the DRF example and this seems to be a simple thing to achieve. https://www.django-rest-framework.org/api-guide/relations/#api-reference But

Django Rest Framework With Only Function Response

I just want to make a simple API with DRF. The API going to get a “keyword” from URL, and that “keyword” will go to a function. And function response is going to be API response. Simple Example: http://127.0.0.1:8000/api/langdetect/helloworld/ RESULT: It’s all easy. How can I make this? I read the doc but every example is making with Models, serializers

Advertisement