Created
November 1, 2016 13:26
-
-
Save aechiara/17d32a5e6f57b28fafc2e0f3ee817a32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def download(request, id): | |
arquivo = get_object_or_404(Arquivo, id_arquivo=id) | |
response = HttpResponse(FileWrapper(arquivo.file), content_type='application/zip') | |
response['Content-Disposition'] = 'attachment; filename={}'.format(os.path.basename(arquivo.file.name)) | |
return response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment