class ABC(generics.ListCreateApiView):
@swagger_auto_schema(
operation_description="THIS API IS TO CREATE MESSAGES IN A LIST ",
auto_schema=AcceptFormDataSchema,
request_body=MessageGetSerializer
)
def get_queryset(self):
data =self.request.GET.get("code")
...
@swagger_auto_schema(
operation_description="THIS API IS TO CREATE MESSAGES IN A LIST ",
request_body=openapi.Schema(
type=openapi.TYPE_OBJECT,
required=["data"],
properties={
"code": openapi.Schema(type=openapi.TYPE_STRING),
},
)
)
def post(self, request):
brand_code = request.data.get("code")
...
#serializer.py
class MessageSerializer(serializers.ModelSerializer):
class Meta:
model = Messages
fields = ("message_id", "content", "description")
My post method is working fine with the fields which I required using the same serializer but it's not working for the get_queryset method. Can anyone please suggest something on how I will get the fields using drf-yasg?