[Django]-How to request GET parameters in templates for a list of files?(Django Zip File Download Issue)

4👍

request.GET.get('paths') returns a string representation of your list of paths, not a list object. The returned value would be like this "['/path/file1', 'path/file2']". When you iterate through paths, it actually iterates through each char in your string. That is why it first tries to find a directory with the name [.

To pass a list of file paths to a GET request, you would need to change your url to this

<your_url>?paths=path1&paths=path2&paths=path3...

In your Python code, get the file paths with this

request.GET.getlist('paths')

Leave a comment