📅  最后修改于: 2022-03-11 14:45:50.602000             🧑  作者: Mango
queryset = demo.objects.filter(name="non_existent_name")
if queryset.exists():
serializer = DemoSerializer(queryset, many=True)
return Response(serializer.data)
else:
return Response(status=status.HTTP_404_NOT_FOUND)