Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A simple Django base view to zip and stream several files.

Project Description

Django ZipView

[![Build Status](](

A base view to zip and stream several files.


pip install django-zipview

Usage and examples

To create a zip download view:

* Extend BaseZipView
* implement `get_files`
* That's it

The `get_files` method must return a list of Django's File objects.


from zipview.views import BaseZipView

from emails import Email

class AttachmentsArchiveView(BaseZipView):
"""Download at once all comments for a review."""

def get_files(self):
emails = Email.objects \
.filter(user=self.request.user) \

return [email.attachment.file for email in emails if]

View configuration

By default, the downloaded file is named `` you can set a custom name
by setting the `zipfile_name` parameter.


class ZipView(BaseZipView):
zipfile_name = ''

In case you need to dynamically set the filename, you can override the
`get_archive_name` method. It takes the request as a parameter.


def get_archive_name(self, request):
import datetime
today =
return 'archive_{:%Y%m%d}.zip'.format(today)


Current supported django versions are 1.8 & 1.9.


Django ZipView uses [tox, the testing automation
tool](, to run tests.

To launch tests:

pip install -r requiments/test.txt


Crafted with love by [Thibault Jouannic]( You can
contact him for [Python / Django freelancing

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(4.3 kB) Copy SHA256 Hash SHA256
Source Feb 18, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting