I want to pass request.FILES from a post form to a different form through HttpResponseRedirect, I tried with session variables but I cannot pass a file through them. Is it possible ? if not: How can I do it?.
The reason I want to pass an XML file is because I will need to show the file's processed data in the next view that I am redirecting to with HttpResponseRedirect. Here is a snippet:
# View that handles post data dev my_view(request): if request.method == "POST": form = myForm(request.POST, request.FILES) my_file = request.FILES['xml'] if form.is_valid(): # Magic for passing files to the next view # I tried with session variables, but I couldn't pass # the file, as it couldn't be serialized. return HttpResponseRedirect(reverse('form2')) dev my_view2(request): pass # Here I'd receive the data from the previous form # and handle it according to my needs.
Thanks in advance.
django-formtools
? This was once part of the django core but was removed and separated into a standalone package. django-formtools.readthedocs.org/en/latest – Rod Xavier