I want to build a Django webpage, where the user uploads docx files, edites them and downloads as new docx files. When the file is downloaded, the content is spoiled.
The views.py function is the following:
from docx import Document
def edit_file(request, upload_id):
    instance = get_object_or_404(DocFile, id=upload_id)
    document = Document(instance.agreement)
        # here is some code to edit the docx file
        file_name = '{}.doc'.format(contract_name)
        response = HttpResponse(document, content_type='application/msword')
        response['Content-Disposition'] = 'attachment; filename="{}"'.format(file_name)
        document.save(response)
        return response
    return render(request, 'uploads/file_detail.html', {
        'variables': variables, 'form_field': form_field
    })
I edit this kind of content file 
And get this spoiled content in the new file
Is it possible to get downloaded the edited file but not the content be spoiled in this way? If no, what other ways are possible?