I have this code
#VIEWS
def report_pdf(request, queryset):
if request.method == "GET":
trans = Transaction.objects.filter(id__in=queryset)
return something
#URLS
path("pdf/<uuid:queryset>", views.report_pdf, name="get_pdf")
#FRONT END
const handlePDFDownload = (ids) => {
const body = ids
axios.get(`/calc/pdf/`,body , {
responseType: 'blob',
}).then(res => {
fileDownload(res.data, 'filename.zip');
console.log(res, 'downloading');
}).catch(err => {
console.log(err);
})
}
Now from my frontend react iam sending a get
request to this endpoint
with a list of UUID
values.
I cant find a way to access that list in my view coming from frontend.
Would appreciate any suggestions!
I would suggest you pass the uuids as query params to the url as
../pdf?queryset=<uuids here>
then get the list in your view as
queryset = request.GET.get('queryset')
and then use queryset
further in view.