mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-05-05 14:14:49 +00:00
43 lines
1.4 KiB
Text
43 lines
1.4 KiB
Text
###################
|
|
django-downloadview
|
|
###################
|
|
|
|
Django-DownloadView provides (class-based) generic download views for Django.
|
|
|
|
Example, in some urls.py:
|
|
|
|
.. code-block:: python
|
|
|
|
from django.conf.urls import url, url_patterns
|
|
from django_downloadview import ObjectDownloadView
|
|
from demoproject.download.models import Document # A model with a FileField
|
|
|
|
|
|
# ObjectDownloadView inherits from django.views.generic.BaseDetailView.
|
|
download = ObjectDownloadView.as_view(model=Document, file_field='file')
|
|
|
|
url_patterns = ('',
|
|
url('^download/(?P<slug>[A-Za-z0-9_-]+)/$', download, name='download'),
|
|
)
|
|
|
|
Several views are provided to cover frequent use cases:
|
|
|
|
* ``ObjectDownloadView`` when you have a model with a file field.
|
|
* ``StorageDownloadView`` when you manage files in a storage.
|
|
* ``PathDownloadView`` when you have an absolute filename on local filesystem.
|
|
* ``VirtualDownloadView`` when you the file is generated on the fly.
|
|
|
|
See :doc:`views` for details.
|
|
|
|
Then get increased performances with :doc:`optimizations/index`.
|
|
|
|
|
|
**********
|
|
Ressources
|
|
**********
|
|
|
|
* Documentation: http://django-downloadview.readthedocs.org
|
|
* PyPI page: http://pypi.python.org/pypi/django-downloadview
|
|
* Code repository: https://github.com/benoitbryon/django-downloadview
|
|
* Bugtracker: https://github.com/benoitbryon/django-downloadview/issues
|
|
* Continuous integration: https://travis-ci.org/benoitbryon/django-downloadview
|