Skip to content

Commit

Permalink
return queryset as response
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranshu1902 committed Apr 24, 2024
1 parent 48461d3 commit da8788c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ayushma/views/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ def perform_create(self, serializer):
)
@action(detail=True, methods=["get"])
def feedbacks(self, *args, **kwarg):
return ChatFeedback.objects.filter(chat_message__chat__external_id=kwarg["external_id"])
q = ChatFeedback.objects.filter(chat_message__chat__external_id=kwarg["external_id"])
serialized_data = ChatFeedbackSerializer(q, many=True).data
return Response(
{"data": serialized_data},
status=status.HTTP_200_OK,
)

@extend_schema(
tags=("chats",),
Expand Down

0 comments on commit da8788c

Please sign in to comment.