mirror of
https://github.com/jazzband/django-downloadview.git
synced 2026-03-16 22:40:25 +00:00
47 lines
1 KiB
Text
47 lines
1 KiB
Text
################
|
|
HTTPDownloadView
|
|
################
|
|
|
|
.. py:module:: django_downloadview.views.http
|
|
|
|
:class:`HTTPDownloadView` **serves a file given an URL.**, i.e. it acts like
|
|
a proxy.
|
|
|
|
This view is particularly handy when:
|
|
|
|
* the client does not have access to the file resource, while your Django
|
|
server does.
|
|
|
|
* the client does trust your server, your server trusts a third-party, you do
|
|
not want to bother the client with the third-party.
|
|
|
|
|
|
**************
|
|
Simple example
|
|
**************
|
|
|
|
Setup a view to stream files given URL:
|
|
|
|
.. literalinclude:: /../demo/demoproject/http/views.py
|
|
:language: python
|
|
|
|
|
|
************
|
|
Base options
|
|
************
|
|
|
|
:class:`HTTPDownloadView` inherits from
|
|
:class:`~django_downloadview.views.base.DownloadMixin`, which has various
|
|
options such as :attr:`~django_downloadview.views.base.DownloadMixin.basename`
|
|
or :attr:`~django_downloadview.views.base.DownloadMixin.attachment`.
|
|
|
|
|
|
*************
|
|
API reference
|
|
*************
|
|
|
|
.. autoclass:: HTTPDownloadView
|
|
:members:
|
|
:undoc-members:
|
|
:show-inheritance:
|
|
:member-order: bysource
|