From 6c40354f4a40b07be7478d1a369977e2d14e18ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Bryon?= Date: Tue, 28 May 2013 08:34:33 +0200 Subject: [PATCH] Refs #34, refs #35 - Added documentation about DownloadMixin and BaseDownloadView. --- README | 7 +++++-- django_downloadview/views.py | 17 +++++++++-------- docs/views.txt | 25 +++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/README b/README index 635fd50..6a69a0d 100644 --- a/README +++ b/README @@ -25,11 +25,14 @@ 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. +* ``HTTPDownloadView`` when you have an URL (the resource is proxied). * ``VirtualDownloadView`` when you the file is generated on the fly. -See :doc:`views` for details. +See `views `_ +for details. -Then get increased performances with :doc:`optimizations/index`. +Then `setup optimizations to get increased performances +`_. ********** diff --git a/django_downloadview/views.py b/django_downloadview/views.py index 8a23dc7..ab1a0e8 100644 --- a/django_downloadview/views.py +++ b/django_downloadview/views.py @@ -16,18 +16,19 @@ from django_downloadview.response import DownloadResponse class DownloadMixin(object): """Placeholders and base implementation to create file download views. - The get_file() method is a placeholder, which raises NotImplementedError - in base implementation. + .. note:: - The other methods provide an implementation that use the file object - returned by get_file(), supposing the file is hosted on the local - filesystem. + This class does not inherit from + :py:class:`django.views.generic.base.View`. - You may override one or several methods to adapt the implementation to your - use case. + The :py:meth:`get_file` method is a placeholder subclasses must implement. + Base implementation raises ``NotImplementedError``. + + Other methods provide a base implementation that use the file wrapper + returned by :py:meth:`get_file`. """ - #: Response class to be used in render_to_response(). + #: Response class, to be used in :py:meth:`render_to_response`. response_class = DownloadResponse #: Whether to return the response as attachment or not. diff --git a/docs/views.txt b/docs/views.txt index 27d3271..bf10c72 100644 --- a/docs/views.txt +++ b/docs/views.txt @@ -6,6 +6,31 @@ This section contains narrative overview about class-based views provided by django-downloadview. +************* +DownloadMixin +************* + +The :py:class:`django_downloadview.views.DownloadMixin` class is not a view. It +is a base class which you can inherit of to create custom download views. + +``DownloadMixin`` is a base of `BaseDownloadView`_, which itself is a base of +all other django_downloadview's builtin views. + + +**************** +BaseDownloadView +**************** + +The :py:class:`django_downloadview.views.BaseDownloadView` class is a base +class to create download views. It inherits `DownloadMixin`_ and +:py:class:`django.views.generic.base.View`. + +The only thing it does is to implement +:py:meth:`get `: it triggers +:py:meth:`DownloadMixin's render_to_response +`. + + ****************** ObjectDownloadView ******************