Hey guys,

I'm trying to make a view so that my users can download a compressed tar 
archive.  I've seen a ton of examples about downloading files yet cannot 
seem to find anything regarding tar.  Anyone want to drop me an awesome 
example?


for a simple file I have

def download_file(request, pk):
    my_model = SomeModel.objects.get(pk=pk)
    file_path = my_model.get_file_path()

    if os.path.exists(file_path):
        with open(file_path, 'rb') as fh:
            response = HttpResponse(fh.read(), content_type="")
            response['Content-Disposition'] = 'inline; filename=' + os.path.
basename(file_path)
            return reponse




-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/642f29c5-8aea-40f4-a6a7-55a8e7bfac83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to