P. Naoum
P. Naoum

Reputation: 477

Override response of POST in Django Rest Framework

I'm using Django Rest Framework's Generics (generics.ListCreateAPIView), when I make a POST request I get a response of Http code (200/400/..etc.) and a JSON showing the posted data, I need to know how can I override the response to get a custom response.

Note that I use

    def perform_create(self,serializer):
        return Response(<my response>)

to override the POST request handling but I still get the same response

Upvotes: 4

Views: 3618

Answers (1)

Linovia
Linovia

Reputation: 20976

The response from perform_create is ignored. You'll likely want to override the create method using the mixins as example

Upvotes: 5

Related Questions