how to get response with message,error, status in django rest framework
HI Everyone i am creating api using drf but i want response with different formet, below i have mention my current response and expected response.how can achieve me my expected api response formet.
views.py
class TeamlistViewset(viewsets.ViewSet): def list (self,request): team=Team.objects.all() serializer=TeamSerializer(team,many=True) return Response(serializer.data)
api response
[ { "id": 1, "name": "Deadly Shark" } ]
expected api response
views.py
class TeamlistViewset(viewsets.ViewSet): def list (self,request): team=Team.objects.all() serializer=TeamSerializer(team,many=True) return Response(serializer.data)
api response
[ { "id": 1, "name": "Deadly Shark" } ]
expected api response
Comentarios
Publicar un comentario