Please suggest to properly pass the GET parameters for a list of files
I got an error :
FileNotFoundError at /test/ [Errno 2] No such file or directory: '['
This is the error for improperly placing the query string that is referring to the list of files.
My views are as follows:
def submit(request): paths = [list of filenames] context = {'paths' :paths} def test_download(request): paths = request.GET.get('paths') context ={'paths': paths} response = HttpResponse(content_type='application/zip') zip_file = zipfile.ZipFile(response, 'w') for filename in paths: zip_file.write(filename) zip_file.close() response['Content-Disposition'] = 'attachment; filename='+'converted files' return response
templates
<p> <a href ="{% url 'test_download' %}?paths={{ paths|urlencode }} " download>Converted Files</a> </p> <br>